How to show Print preview in form control wpf

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gvuksa
    New Member
    • Feb 2013
    • 7

    How to show Print preview in form control wpf

    Hi,
    I can't figure out how to show print preview in control.
    I have class Printer : PrintDocument that contains what i want to print but how to show that in form and in which control.

    updated:
    To be more precise i have listbox with documents for printing. When user selects document i want to show print preview in some control next to this

    Thanks!
    Last edited by Niheel; Feb 21 '13, 11:02 AM. Reason: added information moved into question
  • gvuksa
    New Member
    • Feb 2013
    • 7

    #2
    I tried this and it works in windows forms application but I need something for WPF application.
    Here I used PrintPreviewCon trol but I don't know how to show it in WPF form.
    Also I would prefer to use DocumentViewer to show preview.
    Can anyone help me with that?
    Code:
            PrintPreviewControl ppc;
        
            //Here goes MouseDown I just used btn_Click for testing
            private void btnClick_Click(object sender, EventArgs e)
            {
                Printer p = new Printer();
                ppc = new PrintPreviewControl();
                ppc.Document = p;
                ppc.Location = new Point(10, 50);
                ppc.Width = 700;
                ppc.Height = 1000;
                ppc.Name = "PPC";
    
                this.Controls.Add(ppc);
            }

    Comment

    Working...