PrinterSettings.PrinterResolutionCollection 类
包含 PrinterResolution 对象的集合。
**命名空间:**System.Drawing.Printing
**程序集:**System.Drawing(在 system.drawing.dll 中)
语法
声明
Public Class PrinterResolutionCollection
Implements ICollection, IEnumerable
用法
Dim instance As PrinterResolutionCollection
public class PrinterResolutionCollection : ICollection, IEnumerable
public ref class PrinterResolutionCollection : ICollection, IEnumerable
public class PrinterResolutionCollection implements ICollection, IEnumerable
public class PrinterResolutionCollection implements ICollection, IEnumerable
备注
PrinterSettings.PrinterResolutionCollection 包含 PrinterResolution 实例,该实例通过 PrinterResolution.Kind 属性(它包含 PrinterResolutionKind 值之一)表示受支持的打印机分辨率。
通常可以通过 PageSettings.PrinterResolution 属性将打印机分辨率设置为有效的 PrinterResolution 实例(可通过 PrinterResolutions 集合获得)。
如果 PrinterResolutionKind 为 Custom,则使用 X 和 Y 属性分别确定水平方向和垂直方向的自定义打印机分辨率。
示例
下面的代码示例用受支持的分辨率填充 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.PrinterSettings.PrinterResolutionCollection
线程安全
此类型的任何公共静态(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
请参见
参考
PrinterSettings.PrinterResolutionCollection 成员
System.Drawing.Printing 命名空间
PrinterResolution 类
PrinterSettings.PrinterResolutions 属性
PrinterSettings.InstalledPrinters 属性
PrinterSettings.PaperSizes 属性
PrinterSettings.PaperSources 属性