CheckBox.AutoCheck Egenskap

Definition

Hämtar eller anger ett värde som anger om Checked värdena eller CheckState och CheckBoxutseendet ändras automatiskt när CheckBox klickas.

public:
 property bool AutoCheck { bool get(); void set(bool value); };
public bool AutoCheck { get; set; }
member this.AutoCheck : bool with get, set
Public Property AutoCheck As Boolean

Egenskapsvärde

true Checked om värdet eller CheckState värdet och kontrollens utseende ändras automatiskt för Click händelsen, annars false. Standardvärdet är true.

Exempel

Följande kodexempel skapar och initierar en CheckBox, ger den utseendet på en växlingsknapp, anger AutoCheck till falseoch lägger till den i en Form.

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.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 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

Kommentarer

Om AutoCheck värdet är falskt måste du lägga till kod för att uppdatera Checked värdena eller CheckState i Click händelsehanteraren.

Gäller för