Wpf sdk research printing (1) printdialog

Source: Internet
Author: User
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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.