PaperSource Class
Assembly: System.Drawing (in system.drawing.dll)
This class is used by PrinterSettings.PaperSources and PageSettings.PaperSource properties to get the paper source trays that are available on the printer and to set the paper source for a page, respectively.
For more information about printing, see the System.Drawing.Printing namespace overview.
The following code example populates the comboPaperSource combo box with the printer's supported paper sources. The SourceName is identified as the property that provides the display string for the item being added through the DisplayMember property of the combo box. The example requires that a PrintDocument variable named printDoc exists and that the specific combo box exists.
' Add list of paper sources found on the printer to the combo box. ' The DisplayMember property is used to identify the property that will provide the display string. comboPaperSource.DisplayMember = "SourceName" Dim pkSource As PaperSource For i = 0 to printDoc.PrinterSettings.PaperSources.Count - 1 pkSource = printDoc.PrinterSettings.PaperSources.Item(i) comboPaperSource.Items.Add(pkSource) Next
// Add list of paper sources found on the printer to the combo box.
// The DisplayMember property is used to identify the property that
// will provide the display string.
comboPaperSource.set_DisplayMember("SourceName");
PaperSource pkSource;
for (int i = 0; i < printDoc.get_PrinterSettings().get_PaperSources().
get_Count(); i++) {
pkSource = printDoc.get_PrinterSettings().get_PaperSources().
get_Item(i);
comboPaperSource.get_Items().Add(pkSource);
}
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.