PrinterSettings.PaperSizes Proprietà

Definizione

Ottiene i formati della carta supportati da questa stampante.Gets the paper sizes that are supported by this printer.

public:
 property System::Drawing::Printing::PrinterSettings::PaperSizeCollection ^ PaperSizes { System::Drawing::Printing::PrinterSettings::PaperSizeCollection ^ get(); };
public System.Drawing.Printing.PrinterSettings.PaperSizeCollection PaperSizes { get; }
member this.PaperSizes : System.Drawing.Printing.PrinterSettings.PaperSizeCollection
Public ReadOnly Property PaperSizes As PrinterSettings.PaperSizeCollection

Valore della proprietà

Oggetto PrinterSettings.PaperSizeCollection che rappresenta i formati della carta supportati da questa stampante.A PrinterSettings.PaperSizeCollection that represents the paper sizes that are supported by this printer.

Esempi

Nell'esempio di codice seguente la comboPaperSize casella combinata viene popolata con i formati di carta supportati della stampante.The following code example populates the comboPaperSize combo box with the printer's supported paper sizes. Inoltre, viene creato un formato di carta personalizzato che viene aggiunto alla casella combinata.In addition, a custom paper size is created and added to the combo box. Viene identificato come la proprietà che fornisce la stringa di visualizzazione per l'elemento da aggiungere tramite la DisplayMember proprietà della casella combinata. PaperNameThe PaperName is identified as the property that provides the display string for the item being added through the DisplayMember property of the combo box. Per l'esempio è necessario PrintDocument che esista printDoc una variabile denominata e che la casella combinata specifica esista.The example requires that a PrintDocument variable named printDoc exists and that the specific combo box exists.

// Add list of supported paper sizes found on the printer.
// The DisplayMember property is used to identify the property that will provide the display String*.
comboPaperSize->DisplayMember = "PaperName";
PaperSize^ pkSize;
for ( int i = 0; i < printDoc->PrinterSettings->PaperSizes->Count; i++ )
{
   pkSize = printDoc->PrinterSettings->PaperSizes[ i ];
   comboPaperSize->Items->Add( pkSize );
}

// Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
PaperSize^ pkCustomSize1 = gcnew PaperSize( "First custom size",100,200 );
comboPaperSize->Items->Add( pkCustomSize1 );
// Add list of supported paper sizes found on the printer. 
// The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSize.DisplayMember = "PaperName";

PaperSize pkSize;
for (int i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++){
    pkSize = printDoc.PrinterSettings.PaperSizes[i];
    comboPaperSize.Items.Add(pkSize);
}

// Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
PaperSize pkCustomSize1 = new PaperSize("First custom size", 100, 200);

comboPaperSize.Items.Add(pkCustomSize1);

' Add list of supported paper sizes found on the printer. 
' The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSize.DisplayMember = "PaperName"

Dim pkSize As PaperSize
For i = 0 to printDoc.PrinterSettings.PaperSizes.Count - 1
    pkSize = printDoc.PrinterSettings.PaperSizes.Item(i)
    comboPaperSize.Items.Add(pkSize)
Next

' Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
Dim pkCustomSize1 As New PaperSize("Custom Paper Size", 100, 200)

comboPaperSize.Items.Add(pkCustomSize1)

Commenti

Contiene istanze che rappresentano i formati della carta tramite la PaperSize.Kind proprietà, che contiene uno dei PaperKind valori di. PaperSize PrinterSettings.PaperSizeCollectionThe PrinterSettings.PaperSizeCollection contains PaperSize instances that represent the paper sizes through the PaperSize.Kind property, which contains one of the PaperKind values.

In genere, il formato della carta della pagina viene impostato PageSettings.PaperSize tramite la proprietà su PaperSize un valido disponibile PaperSizes tramite la raccolta.Typically, you set a page's paper size through the PageSettings.PaperSize property to a valid PaperSize available through the PaperSizes collection.

Per specificare un formato di carta personalizzato, vedere PaperSize il costruttore.To specify a custom paper size, see the PaperSize constructor.

Si applica a

Vedi anche