' VB Public Class MyPrintPreviewControl in .NET

Generator QR-Code in .NET ' VB Public Class MyPrintPreviewControl

' VB Public Class MyPrintPreviewControl
Generate QR In VS .NET
Using Barcode creation for ASP.NET Control to generate, create QR-Code image in ASP.NET applications.
www.OnBarcode.com
Encoding Bar Code In .NET
Using Barcode printer for ASP.NET Control to generate, create barcode image in ASP.NET applications.
www.OnBarcode.com
Inherits PrintPreviewControl
QR Code JIS X 0510 Generator In Visual C#.NET
Using Barcode creation for VS .NET Control to generate, create QR Code 2d barcode image in VS .NET applications.
www.OnBarcode.com
Create QR Code In VS .NET
Using Barcode maker for Visual Studio .NET Control to generate, create Quick Response Code image in VS .NET applications.
www.OnBarcode.com
Public Sub AddColumn()
QR Code JIS X 0510 Generation In VB.NET
Using Barcode generator for .NET framework Control to generate, create QR Code ISO/IEC18004 image in Visual Studio .NET applications.
www.OnBarcode.com
Encode Barcode In VS .NET
Using Barcode creation for ASP.NET Control to generate, create bar code image in ASP.NET applications.
www.OnBarcode.com
Me.Columns += 1
Making 2D Barcode In Visual Studio .NET
Using Barcode encoder for ASP.NET Control to generate, create Matrix Barcode image in ASP.NET applications.
www.OnBarcode.com
PDF417 Drawer In Visual Studio .NET
Using Barcode maker for ASP.NET Control to generate, create PDF 417 image in ASP.NET applications.
www.OnBarcode.com
End Sub
1D Maker In VS .NET
Using Barcode encoder for ASP.NET Control to generate, create Linear Barcode image in ASP.NET applications.
www.OnBarcode.com
Generating UPC-A Supplement 5 In .NET
Using Barcode generator for ASP.NET Control to generate, create UPCA image in ASP.NET applications.
www.OnBarcode.com
End Class
QR Encoder In .NET
Using Barcode generation for ASP.NET Control to generate, create QR Code ISO/IEC18004 image in ASP.NET applications.
www.OnBarcode.com
Make EAN-8 Supplement 2 Add-On In .NET
Using Barcode creation for ASP.NET Control to generate, create EAN8 image in ASP.NET applications.
www.OnBarcode.com
// C# public class MyPrintPreviewControl:PrintPreviewControl {
Recognizing Code 128B In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Make EAN13 In None
Using Barcode printer for Font Control to generate, create GTIN - 13 image in Font applications.
www.OnBarcode.com
public void AddColumn()
Data Matrix Scanner In .NET
Using Barcode reader for VS .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Encoding UCC-128 In Visual Studio .NET
Using Barcode creation for Reporting Service Control to generate, create EAN 128 image in Reporting Service applications.
www.OnBarcode.com
this.Columns++;
Bar Code Printer In None
Using Barcode drawer for Office Word Control to generate, create bar code image in Office Word applications.
www.OnBarcode.com
Printing PDF-417 2d Barcode In None
Using Barcode printer for Microsoft Excel Control to generate, create PDF-417 2d barcode image in Microsoft Excel applications.
www.OnBarcode.com
Lab: Create a Customized PrintPreview Form
PDF417 Drawer In Visual Studio .NET
Using Barcode creation for .NET framework Control to generate, create PDF 417 image in .NET framework applications.
www.OnBarcode.com
Code128 Creation In .NET
Using Barcode generator for Visual Studio .NET Control to generate, create Code128 image in Visual Studio .NET applications.
www.OnBarcode.com
In this exercise, you will create a customized PrintPreview form and add it to the solu tion you created in Lesson 2, Constructing Print Documents. You will add a PrintPreviewControl to a form and add controls that allow the user to specify the number of rows and columns, to specify the magnification, and to turn anti-aliasing on and off.
Exercise 1: Creating a Customized PrintPreview Form
1. Open the solution you completed in Lesson 2, or open the completed Lesson 2 solution on the companion CD. 2. Add a new Form to the project.
10
Printing in Windows Forms
3. From the Toolbox, drag a SplitContainer onto the form. The Orientation property should be set to vertical. 4. From the Toolbox, drag a PrintPreviewControl onto Panel2 and set the Dock prop erty to Fill. 5. For C# only: Set the Modifiers property of printPreviewControl1 to Internal. 6. From the Toolbox, add three Label controls, three NumericUpDown controls, one Checkbox control, and one Button control onto Panel1. Associate the labels with the NumericUpDown controls and set the properties as described in the follow ing table: Control Label1 Label2 Label3 NumericUpDown1 NumericUpDown2 NumericUpDown3 NumericUpDown1 NumericUpDown2 NumericUpDown3 NumericUpDown3 CheckBox1 Button1 Property Text Text Text Minimum Minimum Minimum Maximum Maximum Maximum Increment Text Text Value Rows
Columns
Magnification
Anti-Alias
Print
7. Double-click NumericUpDown1 and add the following code to the NumericUpDown_ValueChanged event handler:
' VB PrintPreviewControl1.Rows = NumericUpDown1.Value // C# printPreviewControl1.Rows = (int)numericUpDown1.Value;
Lesson 3: Creating a Customized PrintPreview Component
8. In the Designer, double-click NumericUpDown2 and add the following code to the NumericUpDown2_ValueChanged event handler:
' VB PrintPreviewControl1.Columns = NumericUpDown2.Value // C# printPreviewControl1.Columns = (int)numericUpDown2.Value;
9. In the Designer, double-click NumericUpDown3 and add the following code to the NumericUpDown3_ValueChanged event handler:
' VB PrintPreviewControl1.Zoom = NumericUpDown3.Value / 100 // C# printPreviewControl1.Zoom = (double)numericUpDown3.Value / 100;
10. In the Designer, double-click CheckBox1 and add the following code to the CheckBox1_CheckChanged event handler:
' VB PrintPreviewControl1.UseAntiAlias = CheckBox1.Checked // C# printPreviewControl1.UseAntiAlias = checkBox1.Checked;
11. In the Designer, double-click Button1 and add the following code to the Button1_Click event handler:
' VB Me.DialogResult = Windows.Forms.DialogResult.OK // C# this.DialogResult = System.Windows.Forms.DialogResult.OK;
12. In the Code Editor for Form1, comment out the existing code in the PrintPreviewToolStripMenuItem_Click event handler and add the following code:
' VB Dim aForm As New Form2
Dim aResult As Windows.Forms.DialogResult
aForm.PrintPreviewControl1.Document = PrintDocument1
aResult = aForm.ShowDialog
If aResult = Windows.Forms.DialogResult.Ok Then
PrintDocument1.Print
End If
// C# Form2 aForm = new Form2();
System.Windows.Forms.DialogResult aResult;
aForm.printPreviewControl1.Document = printDocument1;
10
Printing in Windows Forms
aResult = aForm.ShowDialog(); if (aResult == System.Windows.Forms.DialogResult.OK)
printDocument1.Print();
Press F5 to build and run your application. Select a text file with the Open File menu command and then click Print Preview to test your new PrintPreview form.
Lesson Summary
The PrintPreviewControl is the control at the heart of the PrintPreviewDialog and contains all of the functionality required to call the PrintPages event and redirect the output to the control. The Document property represents the PrintDocument component that is previewed. The PrintPreviewControl exposes properties that allow you to set the number of rows, number of columns, the zoom level, whether to use anti-aliasing, and the start page. You can set these properties to configure your control. If you need to add additional methods or events to your PrintPreviewControl, you can create a class that inherits the PrintPreviewControl and add additional members.
Lesson Review
The following questions are intended to reinforce key information presented in this lesson. The questions are also available on the companion CD if you prefer to review them in electronic form.
NOTE
Answers
Answers to these questions and explanations of why each choice is right or wrong are located in the Answers section at the end of the book.
1. Which of the following values for the Zoom property will cause the document to be previewed at 250 percent of normal size A. 250 B. 25 C. 2.5 D. .25
Copyright © OnBarcode.com . All rights reserved.