Share via


Size Konstruktor

Definisi

Menginisialisasi instans Size baru struktur dari yang ditentukan Point.

Overload

Size(Point)

Menginisialisasi instans Size baru struktur dari struktur yang ditentukan Point .

Size(Int32, Int32)

Menginisialisasi instans Size baru struktur dari dimensi yang ditentukan.

Size(Point)

Sumber:
Size.cs
Sumber:
Size.cs
Sumber:
Size.cs

Menginisialisasi instans Size baru struktur dari struktur yang ditentukan 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)

Parameter

pt
Point

Point Struktur untuk menginisialisasi struktur iniSize.

Berlaku untuk

Size(Int32, Int32)

Sumber:
Size.cs
Sumber:
Size.cs
Sumber:
Size.cs

Menginisialisasi instans Size baru struktur dari dimensi yang ditentukan.

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)

Parameter

width
Int32

Komponen lebar dari yang baru Size.

height
Int32

Komponen tinggi dari yang baru Size.

Contoh

Contoh kode berikut menunjukkan cara menggunakan Point.Point konstruktor System.Drawing.ContentAlignment dan Size enumerasi. Untuk menjalankan contoh ini, tempelkan kode ini ke dalam Formulir Windows yang berisi label bernama Label1 dan panggil InitializeLabel1 metode dalam konstruktor formulir.

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

Berlaku untuk