Setting the Paper Size
To set the paper size, use the PageSettings property in the designer or in code.
In the Designer
1. Locate the PageSettings property for C1PrintDocument in the Properties window and click the ellipsis button.
The Page Setup dialog box will appear.
2. Locate the Paper area and set the Size box to Legal.
3. Click OK to close the Page Setup dialog box.
In Code
The following code sets the paper size to Legal:
Dim o As System.Drawing.Printing.PaperSize
For Each o In Me.C1PrintPreview1.PrinterSettings.PaperSizes
If o.Kind = System.Drawing.Printing.PaperKind.Legal Then
Me.C1PrintPreview1.PageSettings.PaperSize = o
Exit For
End If
Next o
• C#
foreach (System.Drawing.Printing.PaperSize o in this.c1PrintPreview1.PrinterSettings.PaperSizes)
{
if (o.Kind == System.Drawing.Printing.PaperKind.Legal)
{
this.c1PrintPreview1.PageSettings.PaperSize = o
break;
}
}
|