PaperSize Constructeurs

Définition

Initialise une nouvelle instance de la classe PaperSize.

Surcharges

PaperSize()

Initialise une nouvelle instance de la classe PaperSize.

PaperSize(String, Int32, Int32)

Initialise une nouvelle instance de la classe PaperSize.

Remarques

Le tableau suivant indique les valeurs de propriétés initiales d'une instance de la classe PaperSize.

Propriété Valeur initiale
Kind PaperKind.Custom
PaperName String.Empty

PaperSize()

Source:
PaperSize.cs
Source:
PaperSize.cs
Source:
PaperSize.cs

Initialise une nouvelle instance de la classe PaperSize.

public:
 PaperSize();
public PaperSize ();
Public Sub New ()

S’applique à

PaperSize(String, Int32, Int32)

Source:
PaperSize.cs
Source:
PaperSize.cs
Source:
PaperSize.cs

Initialise une nouvelle instance de la classe PaperSize.

public:
 PaperSize(System::String ^ name, int width, int height);
public PaperSize (string name, int width, int height);
new System.Drawing.Printing.PaperSize : string * int * int -> System.Drawing.Printing.PaperSize
Public Sub New (name As String, width As Integer, height As Integer)

Paramètres

name
String

Nom du papier.

width
Int32

Largeur du papier, en centièmes de pouce.

height
Int32

Hauteur du papier, en centièmes de pouce.

Exemples

L’exemple de code suivant remplit la comboPaperSize zone de liste modifiable avec les formats de papier pris en charge de l’imprimante. En outre, un format de papier personnalisé est créé et ajouté à la zone de liste déroulante. est PaperName 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 modifiable 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

La propriété d’un PaperSize créé avec ce constructeur a Kind toujours la Customvaleur . Les Width valeurs de propriété et Height ne peuvent être définies que pour les objets personnalisés PaperSize .

S’applique à