PrinterResolution 类
表示打印机支持的分辨率。
**命名空间:**System.Drawing.Printing
**程序集:**System.Drawing(在 system.drawing.dll 中)
语法
声明
<SerializableAttribute> _
Public Class PrinterResolution
用法
Dim instance As PrinterResolution
[SerializableAttribute]
public class PrinterResolution
[SerializableAttribute]
public ref class PrinterResolution
/** @attribute SerializableAttribute() */
public class PrinterResolution
SerializableAttribute
public class PrinterResolution
备注
此类供 PrinterSettings.PrinterResolutions 属性用来获取打印机上可用的打印机分辨率,供 PageSettings.PrinterResolution 属性用来设置页面的打印分辨率。
使用 Kind 属性可以确定打印机的分辨率类型是否为 PrinterResolutionKind 值 Custom。如果是,则分别使用 X 和 Y 属性来确定打印机水平方向和垂直方向的分辨率。
有关打印的更多信息,请参见 System.Drawing.Printing 命名空间概述。
示例
下面的代码示例用受支持的分辨率填充 comboPrintResolution
组合框。该示例假定名为 printDoc
的变量 PrintDocument 和特定的组合框都已存在。
' 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);
}
继承层次结构
System.Object
System.Drawing.Printing.PrinterResolution
线程安全
此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。
平台
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
请参见
参考
PrinterResolution 成员
System.Drawing.Printing 命名空间
PrinterResolutionKind
PrinterSettings
PrinterSettings.PrinterResolutions
PageSettings.PrinterResolution 属性