Figure 119 Reading printer properties in Visual Studio .NET

Creating Code128 in Visual Studio .NET Figure 119 Reading printer properties
Figure 119 Reading printer properties
Code128 Printer In .NET Framework
Using Barcode encoder for .NET framework Control to generate, create Code 128C image in .NET framework applications.
We will be using many PrinterSettings class members throughout this chapter
Code-128 Decoder In .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in VS .NET applications.
[ Team LiB ]
Bar Code Drawer In Visual Studio .NET
Using Barcode creator for Visual Studio .NET Control to generate, create barcode image in Visual Studio .NET applications.
This document was created by an unregistered ChmMagic, please go to http://wwwbisentercom to register it Thanks
Read Barcode In VS .NET
Using Barcode reader for .NET framework Control to read, scan read, scan image in .NET applications.
[ Team LiB ]
Code128 Drawer In C#
Using Barcode drawer for VS .NET Control to generate, create Code 128 Code Set A image in .NET applications.
This document was created by an unregistered ChmMagic, please go to http://wwwbisentercom to register it Thanks
Encode Code 128 Code Set B In Visual Studio .NET
Using Barcode drawer for ASP.NET Control to generate, create Code 128B image in ASP.NET applications.
115 The PrintDocument and
Code 128 Code Set C Generation In VB.NET
Using Barcode maker for .NET framework Control to generate, create Code 128 Code Set A image in .NET framework applications.
Print
Making EAN-13 In .NET
Using Barcode encoder for Visual Studio .NET Control to generate, create European Article Number 13 image in Visual Studio .NET applications.
Events
Paint GS1-128 In Visual Studio .NET
Using Barcode creator for Visual Studio .NET Control to generate, create GS1-128 image in VS .NET applications.
So far we have seen how to print simple text and how to read and set printer settings In the previous sections we saw that in a printing application, we create a PrintDocument object, set its printer name, set the printpage event handler, and then call the Print method PrintDocument offers more than this In this section we will cover PrintDocument members and print events The PrintDocument class is used to tell the printing system how printing will take place Table 114 describes the properties of the PrintDocument class Besides the properties described in Table 114, PrintDocument also provides printing-related methods that invoke print events These methods are described in Table 115
Bar Code Creation In .NET
Using Barcode creation for .NET framework Control to generate, create bar code image in .NET applications.
Table 114 PrintDocument properties
Printing ECC200 In .NET Framework
Using Barcode creator for .NET framework Control to generate, create Data Matrix 2d barcode image in .NET framework applications.
Property DefaultPageSettings DocumentName Description Represents the page settings using aPageSettings object Returns the name of the document to be displayed in a print status dialog box or printer queue while printing the document Returns the print controller that guides the printing process Returns the printer settings represented by aPrinterSettings object
Painting Leitcode In Visual Studio .NET
Using Barcode creator for Visual Studio .NET Control to generate, create Leitcode image in .NET applications.
PrintController PrinterSettings
Code 39 Reader In .NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications.
Table 115 PrintDocument methods
Data Matrix 2d Barcode Generator In C#.NET
Using Barcode drawer for VS .NET Control to generate, create Data Matrix ECC200 image in Visual Studio .NET applications.
Method OnBeginPrint Description Raises the BeginPrint event, which is called after the Print method and before the first page of the document is printed OnEndPrint OnPrintPage Raises the EndPrint event, which is called when the last page of the document has been printed Raises the PrintPage event, which is called before a page prints
Data Matrix Decoder In .NET Framework
Using Barcode decoder for Visual Studio .NET Control to read, scan read, scan image in .NET applications.
OnQueryPageSettings Raises the QueryPageSettings event, which is called immediately before each PrintPage event Print Starts the document's printing process
GS1 128 Generation In Java
Using Barcode printer for Java Control to generate, create UCC-128 image in Java applications.
All of these methods allow derived classes to handle the event without attaching a delegate This is the preferred technique for handling the event in a derived class We will discuss these methods and their events, and how to handle them, in our examples
Code 39 Full ASCII Creation In Visual C#
Using Barcode generation for VS .NET Control to generate, create ANSI/AIM Code 39 image in Visual Studio .NET applications.
1151 Understanding
Encoding Barcode In .NET
Using Barcode drawer for ASP.NET Control to generate, create bar code image in ASP.NET applications.
Print
Create EAN / UCC - 13 In VS .NET
Using Barcode creation for ASP.NET Control to generate, create EAN13 image in ASP.NET applications.
Events
Make EAN-13 In Java
Using Barcode generation for Java Control to generate, create EAN 13 image in Java applications.
This document was created by an unregistered ChmMagic, please go to http://wwwbisentercom to register it Thanks
During the printing process, the printing system fires events according to the stage of a printing process The three common events are BeginPrint, PrintPage, and EndPrint As their names indicate, theBeginPrint event occurs when thePrint method is called, and the EndPrint event occurs when the last page of the document has been printed The PrintPage event occurs for each page being printed (as in Figure 1110) when the Print method is called and after the BeginPrint event has occurred
Figure 1110 Print events
Figure 1110 shows a flowchart for the print events during a printing process The BeginPrint event is raised after the Print method is called Then the printing process checks if there are any pages If there are, the PrintPage event occurs, which is responsible for the actual printing, and the control goes back to check if there are more pages to print When all pages are done printing, the EndPage event is fired The PrintEventArgs class provides data forBeginPrint and EndPrint events This class is inherited from CancelEventArgs, which implements a single property called Cancel, that indicates if an event should be canceled (in the current NET Framework release, PrintEventArgs is reserved for future use) The BeginPrint event occurs when thePrint method is called and before the first page prints BeginPrint takes a PrintEventArgs object as an argument This event is the best place to initialize resources The PrintEventHandler method, which is used to handle the event code, is called whenever the BeginPrint event occurs The PrintPage event occurs when thePrint method is called and before a page prints When we create aPrintPageEventHandler delegate, we identify a method that handles the PrintPage event The event handler is called whenever the PrintPage event occurs The code snippet that follows creates a PrintPageEventHandler delegate, where pd_PrintPage is an event handler:
PrintDocument pd = new PrintDocument(); pdPrintPage += new PrintPageEventHandler(pd_PrintPage); PrintPageEventHandler takes a PrintPageEventArgs object as its second argument, which has the six properties described in Table 116
This document was created by an unregistered ChmMagic, please go to http://wwwbisentercom to register it Thanks
The following code snippet shows how to get the Graphics object from PrintPageEventArgs:
public void pd_PrintPage(object sender, PrintPageEventArgs ev) { // Get the Graphics object attached to // PrintPageEventArgs Graphics g = evGraphics; // Use g now } The EndPrint event occurs when the last page of the document has been printed It takes a PrintEventArgs object as an argument This is the best place to free your resources The PrintEventHandler method is called whenever the EndPrint event occurs and is used to handle the event code Now let's write an application that shows how to use these events We create a Windows application and add a a combo box and a button to the form We set ComboBoxName to printersList and the text of the button to PrintEvents Start The final form looks like Figure 1111