PaperSize.PaperName Propriedade

Definição

Obtém ou define o nome do tipo de papel.

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

Valor da propriedade

O nome do tipo de papel.

Exceções

A propriedade Kind não está definida como Custom.

Exemplos

O exemplo de código a seguir preenche a comboPaperSize caixa de combinação com os tamanhos de papel com suporte da impressora. O PaperName é identificado como a propriedade que fornecerá a cadeia de caracteres de exibição para o item que está sendo adicionado por meio da DisplayMember propriedade da caixa de combinação. O exemplo pressupõe que exista uma PrintDocument variável chamada printDoc e que a caixa de combinação específica exista.

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

Comentários

Você só poderá definir o nome do papel se a Kind propriedade estiver definida Customcomo .

Aplica-se a

Confira também