PaperSize.PaperName Propriété

Définition

Obtient ou définit le nom du type de papier.

public:
 property System::String ^ PaperName { System::String ^ get(); void set(System::String ^ value); };
public string PaperName { get; set; }
member this.PaperName : string with get, set
Public Property PaperName As String

Valeur de propriété

String

Nom du type de papier.

Exceptions

La propriété Kind n'a pas la valeur Custom.

Exemples

L’exemple de code suivant remplit la comboPaperSize zone de liste déroulante avec les tailles de papier prises en charge par l’imprimante. L’objet PaperName est identifié comme la propriété qui fournira la chaîne d’affichage de l’élément ajouté via la DisplayMember propriété de la zone de liste déroulante. L’exemple suppose qu’une PrintDocument variable nommée printDoc existe et que la zone de liste déroulante spécifique existe.

// 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)

Remarques

Vous pouvez définir le nom du papier uniquement si la Kind propriété est définie Customsur .

S’applique à

Voir aussi