Size Konstruktorer

Definition

Initierar en ny instans av Size strukturen från den angivna Point.

Överlagringar

Name Description
Size(Point)

Initierar en ny instans av Size strukturen från den angivna Point strukturen.

Size(Int32, Int32)

Initierar en ny instans av Size strukturen från de angivna dimensionerna.

Size(Point)

Källa:
Size.cs
Källa:
Size.cs
Källa:
Size.cs
Källa:
Size.cs
Källa:
Size.cs

Initierar en ny instans av Size strukturen från den angivna Point strukturen.

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)

Parametrar

pt
Point

Den Point struktur som den här Size strukturen ska initieras från.

Gäller för

Size(Int32, Int32)

Källa:
Size.cs
Källa:
Size.cs
Källa:
Size.cs
Källa:
Size.cs
Källa:
Size.cs

Initierar en ny instans av Size strukturen från de angivna dimensionerna.

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)

Parametrar

width
Int32

Breddkomponenten för den nya Size.

height
Int32

Höjdkomponenten för den nya Size.

Exempel

Följande kodexempel visar hur du använder Point.Point konstruktorerna och SizeSystem.Drawing.ContentAlignment uppräkningen. Om du vill köra det här exemplet klistrar du in den här koden i ett Windows formulär som innehåller en etikett med namnet Label1 och anropar metoden InitializeLabel1 i formulärets konstruktor.

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

Gäller för