Size-Konstruktor (Int32, Int32)
Initialisiert eine neue Instanz der Size-Klasse mit den angegebenen Abmessungen.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Sub New ( _
width As Integer, _
height As Integer _
)
'Usage
Dim width As Integer
Dim height As Integer
Dim instance As New Size(width, height)
public Size (
int width,
int height
)
public:
Size (
int width,
int height
)
public Size (
int width,
int height
)
public function Size (
width : int,
height : int
)
Parameter
- width
Die Breite der neuen Size.
- height
Die Höhe der neuen Size.
Beispiel
Im folgenden Codebeispiel wird die Verwendung des System.Drawing.Point-Konstruktors und des Size-Konstruktors sowie der System.Drawing.ContentAlignment-Enumeration veranschaulicht. Fügen Sie zum Ausführen dieses Beispiels diesen Code in ein Windows Form ein, das ein Label-Steuerelement mit dem Namen Label1
enthält, und rufen Sie die IntializeLabel1
-Methode im Konstruktor des Formulars auf.
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
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";
}
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.set_BorderStyle(BorderStyle.FixedSingle);
// Set the size, constructing a size from two integers.
label1.set_Size(new Size(100, 50));
// Set the location, constructing a point from a 32-bit integer
// (using hexadecimal).
label1.set_Location(new Point(0x280028));
// Set and align the text on the lower-right side of the label.
label1.set_TextAlign(ContentAlignment.BottomRight);
label1.set_Text("Bottom Right Alignment");
} //Initializelabel1
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0