Erweitern Minimieren
Dieser Artikel wurde noch nicht bewertet - Dieses Thema bewerten.

Control.Height-Eigenschaft

Aktualisiert: November 2007

Ruft die Höhe des Steuerelements ab oder legt diese fest.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
[BrowsableAttribute(false)]
public int Height { get; set; }
/** @property */
/** @attribute BrowsableAttribute(false) */
public int get_Height()
/** @property */
/** @attribute BrowsableAttribute(false) */
public  void set_Height(int value)

public function get Height () : int
public function set Height (value : int)

Eigenschaftenwert

Typ: System.Int32
Die Höhe des Steuerelements in Pixel.

Wenn Änderungen am Height-Eigenschaftenwert und am Top-Eigenschaftenwert vorgenommen wurden, wird die Änderung des Bottom-Eigenschaftenwerts des Steuerelements erzwungen.

k9w3e9xh.alert_note(de-de,VS.90).gifHinweis:

Die minimale Höhe für das abgeleitete Steuerelement Splitter ist ein Pixel. Die Standardhöhe für das Splitter-Steuerelement ist drei Pixel. Wenn Sie die Höhe des Splitter-Steuerelements auf einen Wert kleiner als 1 festlegen, wird der Eigenschaftenwert auf die Standardhöhe zurückgesetzt.

Im folgenden Codebeispiel werden drei Button-Steuerelemente in einem Formular erstellt und mehrere entsprechende Eigenschaften zum Festlegen von Größe und Position verwendet. Bei diesem Beispiel muss ein Form mit einer Höhe und Breite von mindestens 300 Pixel vorhanden sein.

// Create three buttons and place them on a form using 
// several size and location related properties. 
private void AddOKCancelButtons()
{
   // Set the button size and location using 
   // the Size and Location properties.
   Button buttonOK = new Button();
   buttonOK.Location = new Point(136,248);
   buttonOK.Size = new Size(75,25);
   // Set the Text property and make the 
   // button the form's default button. 
   buttonOK.Text = "&OK";
   this.AcceptButton = buttonOK;

   // Set the button size and location using the Top, 
   // Left, Width, and Height properties.
   Button buttonCancel = new Button();
   buttonCancel.Top = buttonOK.Top;
   buttonCancel.Left = buttonOK.Right + 5;
   buttonCancel.Width = buttonOK.Width;
   buttonCancel.Height = buttonOK.Height;
   // Set the Text property and make the 
   // button the form's cancel button.
   buttonCancel.Text = "&Cancel";
   this.CancelButton = buttonCancel;

   // Set the button size and location using 
   // the Bounds property.
   Button buttonHelp = new Button();
   buttonHelp.Bounds = new Rectangle(10,10, 75, 25);
   // Set the Text property of the button.
   buttonHelp.Text = "&Help";

   // Add the buttons to the form.
   this.Controls.AddRange(new Control[] {buttonOK, buttonCancel, buttonHelp} );
}


// Create three buttons and place them on a form using 
// several size and location related properties. 
private void AddOKCancelButtons()
{
    // Set the button size and location using 
    // the Size and Location properties.
    Button buttonOK = new Button();
    buttonOK.set_Location(new Point(136, 248));
    buttonOK.set_Size(new Size(75, 25));
    // Set the Text property and make the 
    // button the form's default button. 
    buttonOK.set_Text("&OK");
    this.set_AcceptButton(buttonOK);
    // Set the button size and location using the Top, 
    // Left, Width, and Height properties.
    Button buttonCancel = new Button();
    buttonCancel.set_Top(buttonOK.get_Top());
    buttonCancel.set_Left(buttonOK.get_Right() + 5);
    buttonCancel.set_Width(buttonOK.get_Width());
    buttonCancel.set_Height(buttonOK.get_Height());
    // Set the Text property and make the 
    // button the form's cancel button.
    buttonCancel.set_Text("&Cancel");
    this.set_CancelButton(buttonCancel);
    // Set the button size and location using 
    // the Bounds property.
    Button buttonHelp = new Button();
    buttonHelp.set_Bounds(new Rectangle(10, 10, 75, 25));
    // Set the Text property of the button.
    buttonHelp.set_Text("&Help");
    // Add the buttons to the form.
    this.get_Controls().AddRange(new Control[] { buttonOK, buttonCancel,
        buttonHelp });
} //AddOKCancelButtons


Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile für Smartphone, Windows Mobile für Pocket PC

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

.NET Framework

Unterstützt in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 3.5, 2.0, 1.0
Fanden Sie dies hilfreich?
(1500 verbleibende Zeichen)

Community-Beiträge

HINZUFÜGEN
© 2013 Microsoft. Alle Rechte vorbehalten.