Freigeben über


GroupBox.FlatStyle-Eigenschaft

Ruft das Format für die flache Darstellung des Gruppenfeldsteuerelements ab oder legt dieses fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Property FlatStyle As FlatStyle
'Usage
Dim instance As GroupBox
Dim value As FlatStyle

value = instance.FlatStyle

instance.FlatStyle = value
public FlatStyle FlatStyle { get; set; }
public:
property FlatStyle FlatStyle {
    FlatStyle get ();
    void set (FlatStyle value);
}
/** @property */
public FlatStyle get_FlatStyle ()

/** @property */
public void set_FlatStyle (FlatStyle value)
public function get FlatStyle () : FlatStyle

public function set FlatStyle (value : FlatStyle)

Eigenschaftenwert

Einer der FlatStyle-Werte. Der Standardwert ist Standard.

Ausnahmen

Ausnahmetyp Bedingung

InvalidEnumArgumentException

Der zugewiesene Wert ist keiner der FlatStyle-Werte.

Beispiel

Im folgenden Codebeispiel werden ein GroupBox-Steuerelement und zwei RadioButton-Steuerelemente instanziiert und erstellt. Die Optionsfelder (auch als Optionsschaltflächen bezeichnet) werden dem Gruppenfeld hinzugefügt, und das Gruppenfeld wird dem Form hinzugefügt.

Private Sub InitializeMyGroupBox()
   ' Create and initialize a GroupBox and two RadioButton controls.
   Dim groupBox1 As New GroupBox()
   Dim radioButton1 As New RadioButton()
   Dim radioButton2 As New RadioButton()

   ' Set the FlatStyle of the GroupBox.
   groupBox1.FlatStyle = FlatStyle.System   
        
   ' Add the RadioButtons to the GroupBox.
   groupBox1.Controls.Add(radioButton1)
   groupBox1.Controls.Add(radioButton2)
        
   ' Add the GroupBox to the Form.
    Controls.Add(groupBox1)
End Sub 'InitializeMyGroupBox
private void InitializeMyGroupBox()
{
   // Create and initialize a GroupBox and two RadioButton controls.
   GroupBox groupBox1 = new GroupBox();
   RadioButton radioButton1 = new RadioButton();
   RadioButton radioButton2 = new RadioButton();

   // Set the FlatStyle of the GroupBox.
   groupBox1.FlatStyle = FlatStyle.System;
 
   // Add the RadioButtons to the GroupBox.
   groupBox1.Controls.Add(radioButton1);
   groupBox1.Controls.Add(radioButton2);
 
   // Add the GroupBox to the Form.
   Controls.Add(groupBox1);
}
 
private:
   void InitializeMyGroupBox()
   {
      // Create and initialize a GroupBox and two RadioButton controls.
      GroupBox^ groupBox1 = gcnew GroupBox;
      RadioButton^ radioButton1 = gcnew RadioButton;
      RadioButton^ radioButton2 = gcnew RadioButton;
      
      // Add the RadioButtons to the GroupBox.
      groupBox1->Controls->Add( radioButton1 );
      groupBox1->Controls->Add( radioButton2 );
      
      // Add the GroupBox to the Form.
      Controls->Add( groupBox1 );
   }
private void InitializeMyGroupBox()
{
    // Create and initialize a GroupBox and two RadioButton controls.
    GroupBox groupBox1 = new GroupBox();
    RadioButton radioButton1 = new RadioButton();
    RadioButton radioButton2 = new RadioButton();

    // Set the FlatStyle of the GroupBox.
    groupBox1.set_FlatStyle(FlatStyle.System);

    // Add the RadioButtons to the GroupBox.
    groupBox1.get_Controls().Add(radioButton1);
    groupBox1.get_Controls().Add(radioButton2);

    // Add the GroupBox to the Form.
    get_Controls().Add(groupBox1);
} //InitializeMyGroupBox
function InitializeMyGroupBox(){
   // Create and initialize a GroupBox and two RadioButton controls.
   var groupBox1 : GroupBox = new GroupBox()
   var radioButton1 : RadioButton = new RadioButton()
   var radioButton2 : RadioButton = new RadioButton()

   // Set the FlatStyle of the GroupBox.
   groupBox1.FlatStyle = FlatStyle.System   
        
   // Add the RadioButtons to the GroupBox.
   groupBox1.Controls.Add(radioButton1)
   groupBox1.Controls.Add(radioButton2)
        
   // Add the GroupBox to the Form.
    Controls.Add(groupBox1)
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, 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

Siehe auch

Referenz

GroupBox-Klasse
GroupBox-Member
System.Windows.Forms-Namespace
FlatStyle-Enumeration