Setting the Page Size
To set the page size for the document, use the PaperKind property.
1. From the Toolbox, add the C1PrintPreviewControl and C1PrintDocument controls to your project.
2. Click C1PrintPreviewControl1 to select it and in the Properties window set its Document property to C1PrintDocument1.
3. Add the following code to the Form_Load event:
' Make the document.
MakeDoc()
' Generate the document.
Me.C1PrintDocument1.Generate()
• C#
// Make the document.
MakeDoc();
// Generate the document.
this.c1PrintDocument1.Generate();
4. Add the following MakeDoc subroutine, which uses the PaperKind property to set the page size to Legal:
Private Sub MakeDoc()
' Define the page layout for the document.
Dim pl As New C1.C1Preview.PageLayout()
pl.PageSettings = New C1.C1Preview.C1PageSettings()
pl.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Legal
Me.C1PrintDocument1.PageLayouts.Default = pl
End Sub
• C#
private void MakeDoc()
{
// Define the page layout for the document.
C1.C1Preview.PageLayout pl = new C1.C1Preview.PageLayout();
pl.PageSettings = new C1.C1Preview.C1PageSettings();
pl.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Legal;
this.c1PrintDocument1.PageLayouts.Default = pl;
}
What You've Accomplished
The default page size is set to Legal:
|