Size Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Ö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(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
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