Export (0) Print
Expand All

PrinterResolution Class

Represents the resolution supported by a printer.

Namespace: System.Drawing.Printing
Assembly: System.Drawing (in system.drawing.dll)

[SerializableAttribute] 
public class PrinterResolution
/** @attribute SerializableAttribute() */ 
public class PrinterResolution
SerializableAttribute 
public class PrinterResolution
Not applicable.

This class is used by the PrinterSettings.PrinterResolutions and PageSettings.PrinterResolution properties to get the printer resolutions that are available on the printer and to set the printing resolution for a page, respectively.

Use the Kind property to determine whether the printer resolution type is the PrinterResolutionKind value Custom. If so, use the X and Y properties to determine the printer resolution in the horizontal and vertical directions, respectively.

For more information on printing, see the System.Drawing.Printing namespace overview.

The following code example populates the comboPrintResolution combo box with the supported resolutions. The example assumes that a PrintDocument variable named printDoc exists and that the specific combo box exists.

// Add list of printer resolutions found on the printer to the combobox.
// The PrinterResolution's ToString() method will be used to provide the display string.

PrinterResolution pkResolution;
for (int i = 0; i < printDoc.PrinterSettings.PrinterResolutions.Count; i++){
    pkResolution = printDoc.PrinterSettings.PrinterResolutions[i];
    comboPrintResolution.Items.Add(pkResolution);
}

// Add list of printer resolutions found on the printer to the combobox.
// The PrinterResolution's ToString() method will be used to 
// provide the display string.
PrinterResolution pkResolution;
for (int i = 0; i < printDoc.get_PrinterSettings().
    get_PrinterResolutions().get_Count(); i++) {
    pkResolution = printDoc.get_PrinterSettings().
        get_PrinterResolutions().get_Item(i);
    comboPrintResolution.get_Items().Add(pkResolution);
}

System.Object
  System.Drawing.Printing.PrinterResolution

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft