Skip to Content
Windows Forms Programming in Visual Basic .NET
book

Windows Forms Programming in Visual Basic .NET

by Chris Sells, Justin Gehtland
October 2003
Intermediate to advanced
736 pages
15h 25m
English
Addison-Wesley Professional
Content preview from Windows Forms Programming in Visual Basic .NET

Page Settings

You may have noticed that both the MarginBounds and the PageSettings properties of the PrintPageEventArgs class are read-only. Changing PageSettings on-the-fly (including the margins) requires handling the print document's QueryPageSettings event:

Sub printDocument1_QueryPageSettings(sender As Object, _
  e As QueryPageSettingsEventArgs)
  ' Set margins to 0.5" all the way around
  ' (measured in 100ths of an inch)
  e.PageSettings.Margins = New Margins(50, 50, 50, 50)
End Sub

QueryPageSettingsEventArgs provides only a Cancel property and a PageSettings property. The latter is an instance of the PageSettings class:

 Class PageSetings Implements ICloneable ' Constructors Public Overloads Sub New() Public Overloads Sub New(printerSettings ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Visual Basic .NET

Learning Visual Basic .NET

Jesse Liberty
Windows Forms 2.0 Programming

Windows Forms 2.0 Programming

Chris Sells, Michael Weinhardt

Publisher Resources

ISBN: 0321125193Purchase book