Printdialog
This sample uses strates how to create an instance of a simple printdialog and then display it. The sample uses both eXtensible Application Markup Language (XAML) and procedural code.
Use printdialog to display printer settings (showdialog method) and the width/height of the printable area:
The functions of the three buttons are as follows: Public Void Invokeprint ( Object Sender, routedeventargs E)
{
Printdialog pdialog = New Printdialog ();
Pdialog. pagerangeselection = Pagerangeselection. allpages;
Pdialog. userpagerangeenabled = True ;
Pdialog. showdialog ();
}
Public Void Getheight ( Object Sender, routedeventargs E)
{
Printdialog pdialog = New Printdialog ();
Printticket PT = Pdialog. printticket; // Force initialization of the dialog's printticket or printqueue
Txt1.text = Pdialog. printableareaheight. tostring () + " Is the printable height " ;
}
Public Void Getwidth ( Object Sender, routedeventargs E)
{
Printdialog pdialog = New Printdialog ();
Printqueue PQ = Pdialog. printqueue; // Force initialization of the dialog's printticket or printqueue
Txt2.text = Pdialog. printableareawidth. tostring () + " Is the printable width " ;
}
You are familiar with printdialog. Printqueue and printticket are two new classes added by net3.5. In this sample, these two classes do not play any role, or even can be marked out.