PrinterSettings.PrinterResolutions 属性

获取该打印机支持的所有分辨率。

**命名空间:**System.Drawing.Printing
**程序集:**System.Drawing(在 system.drawing.dll 中)

语法

声明
Public ReadOnly Property PrinterResolutions As PrinterResolutionCollection
用法
Dim instance As PrinterSettings
Dim value As PrinterResolutionCollection

value = instance.PrinterResolutions
public PrinterResolutionCollection PrinterResolutions { get; }
public:
property PrinterResolutionCollection^ PrinterResolutions {
    PrinterResolutionCollection^ get ();
}
/** @property */
public PrinterResolutionCollection get_PrinterResolutions ()
public function get PrinterResolutions () : PrinterResolutionCollection

属性值

PrinterSettings.PrinterResolutionCollection,它显示此打印机所支持的分辨率。

备注

PrinterSettings.PrinterResolutionCollection 包含 PrinterResolution 实例,该实例通过 PrinterResolution.Kind 属性(它包含 PrinterResolutionKind 值之一)表示受支持的打印机分辨率。

通常可以通过 PageSettings.PrinterResolution 属性将页的纸张来源设置为有效的 PrinterResolution(可通过 PrinterResolutions 集合获得)。

如果 PrinterResolutionKindCustom,则使用 XY 属性分别确定水平方向和垂直方向的自定义打印机分辨率。

示例

下面的代码示例用受支持的分辨率填充 comboPrintResolution 组合框。该示例要求名为 printDocPrintDocument 变量和特定的组合框都已存在。

' 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.
Dim pkResolution As PrinterResolution
For i = 0 to printDoc.PrinterSettings.PrinterResolutions.Count - 1
    pkResolution = printDoc.PrinterSettings.PrinterResolutions.Item(i)
    comboPrintResolution.Items.Add(pkResolution)
Next
// 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->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);
}

平台

Windows 98、Windows 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

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

PrinterSettings 类
PrinterSettings 成员
System.Drawing.Printing 命名空间
PrinterResolution 类
PrinterSettings.PrinterResolutionCollection
PrinterSettings.InstalledPrinters 属性
PrinterSettings.PaperSizes 属性
PrinterSettings.PaperSources 属性