Freigeben über


CheckBox.AutoCheck-Eigenschaft

Ruft einen Wert ab, der angibt, ob beim Klicken auf die CheckBox der Checked-Wert oder der CheckState-Wert sowie die Darstellung der CheckBox automatisch geändert werden, oder legt diesen fest.

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

Syntax

'Declaration
Public Property AutoCheck As Boolean
'Usage
Dim instance As CheckBox
Dim value As Boolean

value = instance.AutoCheck

instance.AutoCheck = value
public bool AutoCheck { get; set; }
public:
property bool AutoCheck {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_AutoCheck ()

/** @property */
public void set_AutoCheck (boolean value)
public function get AutoCheck () : boolean

public function set AutoCheck (value : boolean)

Eigenschaftenwert

true, wenn der Checked-Wert oder der CheckState-Wert sowie die Darstellung des Steuerelements beim Click-Ereignis automatisch geändert werden, andernfalls false. Der Standardwert ist true.

Hinweise

Wenn AutoCheck auf false festgelegt ist, müssen Sie Code hinzufügen, um den Checked-Wert oder den CheckState-Wert im Click-Ereignishandler zu aktualisieren.

Beispiel

Im folgenden Beispiel wird eine CheckBox erstellt und initialisiert. Diese wird als Umschaltfläche dargestellt, der Wert für AutoCheck wird auf false festgelegt, und sie wird einem Form hinzugefügt.

Public Sub InstantiateMyCheckBox()
    ' Create and initialize a CheckBox.   
    Dim checkBox1 As New CheckBox()
    
    ' Make the check box control appear as a toggle button.
    checkBox1.Appearance = Appearance.Button
    
    ' Turn off the update of the display on the click of the control.
    checkBox1.AutoCheck = False
    
    ' Add the check box control to the form.
    Controls.Add(checkBox1)
End Sub 'InstantiateMyCheckBox
public void InstantiateMyCheckBox()
 {
    // Create and initialize a CheckBox.   
    CheckBox checkBox1 = new CheckBox(); 
    
    // Make the check box control appear as a toggle button.
    checkBox1.Appearance = Appearance.Button;
 
    // Turn off the update of the display on the click of the control.
    checkBox1.AutoCheck = false;
 
    // Add the check box control to the form.
    Controls.Add(checkBox1);
 }
 
public:
   void InstantiateMyCheckBox()
   {
      // Create and initialize a CheckBox.   
      CheckBox^ checkBox1 = gcnew CheckBox;
      
      // Make the check box control appear as a toggle button.
      checkBox1->Appearance = Appearance::Button;
      
      // Turn off the update of the display on the click of the control.
      checkBox1->AutoCheck = false;
      
      // Add the check box control to the form.
      this->Controls->Add( checkBox1 );
   }
public void InstantiateMyCheckBox()
{
    // Create and initialize a CheckBox.   
    CheckBox checkBox1 = new CheckBox();

    // Make the check box control appear as a toggle button.
    checkBox1.set_Appearance(Appearance.Button);

    // Turn off the update of the display on the click of the control.
    checkBox1.set_AutoCheck(false);

    // Add the check box control to the form.
    get_Controls().Add(checkBox1);
} //InstantiateMyCheckBox
public function InstantiateMyCheckBox()
 {
    // Create and initialize a CheckBox.   
    var checkBox1 : CheckBox = new CheckBox(); 
    
    // Make the check box control appear as a toggle button.
    checkBox1.Appearance = Appearance.Button;
 
    // Turn off the update of the display on the click of the control.
    checkBox1.AutoCheck = false;
 
    // Add the check box control to the form.
    Controls.Add(checkBox1);
 }
 

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

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

CheckBox-Klasse
CheckBox-Member
System.Windows.Forms-Namespace