Size Costruttori

Definizione

Inizializza una nuova istanza della Size struttura dall'oggetto specificato Point.

Overload

Nome Descrizione
Size(Point)

Inizializza una nuova istanza della Size struttura dalla struttura specificata Point .

Size(Int32, Int32)

Inizializza una nuova istanza della Size struttura dalle dimensioni specificate.

Size(Point)

Origine:
Size.cs
Origine:
Size.cs
Origine:
Size.cs
Origine:
Size.cs
Origine:
Size.cs

Inizializza una nuova istanza della Size struttura dalla struttura specificata Point .

public:
 Size(System::Drawing::Point pt);
public Size(System.Drawing.Point pt);
new System.Drawing.Size : System.Drawing.Point -> System.Drawing.Size
Public Sub New (pt As Point)

Parametri

pt
Point

Struttura Point da cui inizializzare questa Size struttura.

Si applica a

Size(Int32, Int32)

Origine:
Size.cs
Origine:
Size.cs
Origine:
Size.cs
Origine:
Size.cs
Origine:
Size.cs

Inizializza una nuova istanza della Size struttura dalle dimensioni specificate.

public:
 Size(int width, int height);
public Size(int width, int height);
new System.Drawing.Size : int * int -> System.Drawing.Size
Public Sub New (width As Integer, height As Integer)

Parametri

width
Int32

Componente della larghezza del nuovo Sizeoggetto .

height
Int32

Componente altezza del nuovo Sizeoggetto .

Esempio

Nell'esempio di codice seguente viene illustrato come usare i Point.Point costruttori e Size e l'enumerazione System.Drawing.ContentAlignment . Per eseguire questo esempio, incollare questo codice in un form Windows contenente un'etichetta denominata Label1 e chiamare il metodo InitializeLabel1 nel costruttore del modulo.

void InitializeLabel1()
{
   // Set a border.
   Label1->BorderStyle = BorderStyle::FixedSingle;
   
   // Set the size, constructing a size from two integers.
   Label1->Size = System::Drawing::Size( 100, 50 );
   
   // Set the location, constructing a point from a 32-bit integer
   // (using hexadecimal).
   Label1->Location = Point(0x280028);
   
   // Set and align the text on the lower-right side of the label.
   Label1->TextAlign = ContentAlignment::BottomRight;
   Label1->Text = "Bottom Right Alignment";
}
private void InitializeLabel1()
{
    // Set a border.
    Label1.BorderStyle = BorderStyle.FixedSingle;

    // Set the size, constructing a size from two integers.
    Label1.Size = new Size(100, 50);

    // Set the location, constructing a point from a 32-bit integer
    // (using hexadecimal).
    Label1.Location = new Point(0x280028);

    // Set and align the text on the lower-right side of the label.
    Label1.TextAlign = ContentAlignment.BottomRight;
    Label1.Text = "Bottom Right Alignment";
}
Private Sub InitializeLabel1()

    ' Set a border.
    Label1.BorderStyle = BorderStyle.FixedSingle

    ' Set the size, constructing a size from two integers.
    Label1.Size = New Size(100, 50)

    ' Set the location, constructing a point from a 32-bit integer
    ' (using hexadecimal).
    Label1.Location = New Point(&H280028)

    ' Set and align the text on the lower-right side of the label.
    Label1.TextAlign = ContentAlignment.BottomRight
    Label1.Text = "Bottom Right Alignment"
End Sub

Si applica a