Leggere in inglese

Condividi tramite


Size Costruttori

Definizione

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

Overload

Size(Point)

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

Size(Int32, Int32)

Inizializza una nuova istanza della struttura Size dalle dimensioni specificate.

Size(Point)

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

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

C#
public Size (System.Drawing.Point pt);

Parametri

pt
Point

Struttura Point da cui inizializzare la struttura Size.

Si applica a

.NET 9 e altre versioni
Prodotto Versioni
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Size(Int32, Int32)

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

Inizializza una nuova istanza della struttura Size dalle dimensioni specificate.

C#
public Size (int width, int height);

Parametri

width
Int32

Componente larghezza del nuovo oggetto Size.

height
Int32

Componente altezza della nuova struttura Size.

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 Windows Form contenente un'etichetta denominata Label1 e chiamare il InitializeLabel1 metodo nel costruttore del modulo.

C#
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";
}

Si applica a

.NET 9 e altre versioni
Prodotto Versioni
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1