PrinterSettings.PrinterResolutionCollection.Item[Int32] 属性

定义

获取指定索引处的 PrinterResolutionGets the PrinterResolution at a specified index.

public:
 virtual property System::Drawing::Printing::PrinterResolution ^ default[int] { System::Drawing::Printing::PrinterResolution ^ get(int index); };
public virtual System.Drawing.Printing.PrinterResolution this[int index] { get; }
member this.Item(int) : System.Drawing.Printing.PrinterResolution
Default Public Overridable ReadOnly Property Item(index As Integer) As PrinterResolution

参数

index
Int32

要获取的 PrinterResolution 的索引。The index of the PrinterResolution to get.

属性值

PrinterResolution

指定索引处的 PrinterResolutionThe PrinterResolution at the specified index.

示例

下面的代码示例 comboPrintResolution 用支持的分辨率填充组合框。The following code example populates the comboPrintResolution combo box with the supported resolutions. 该示例要求 PrintDocument 名为的变量 printDoc 存在并且存在特定的组合框。The example requires 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.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.
Dim pkResolution As PrinterResolution
For i = 0 to printDoc.PrinterSettings.PrinterResolutions.Count - 1
    pkResolution = printDoc.PrinterSettings.PrinterResolutions.Item(i)
    comboPrintResolution.Items.Add(pkResolution)
Next

适用于

另请参阅