CheckBox.Appearance CheckBox.Appearance CheckBox.Appearance CheckBox.Appearance Property

定义

获取或设置确定 CheckBox 控件外观的值。Gets or sets the value that determines the appearance of a CheckBox control.

public:
 property System::Windows::Forms::Appearance Appearance { System::Windows::Forms::Appearance get(); void set(System::Windows::Forms::Appearance value); };
public System.Windows.Forms.Appearance Appearance { get; set; }
member this.Appearance : System.Windows.Forms.Appearance with get, set
Public Property Appearance As Appearance

属性值

Appearance 值之一。One of the Appearance values. 默认值为 NormalThe default value is Normal.

异常

示例

下面的代码示例CheckBox创建并初始化, 为其提供切换按钮的外观, 将设置AutoCheckfalse, 并将其添加到Form中。The following code example creates and initializes a CheckBox, gives it the appearance of a toggle button, sets AutoCheck to false, and adds it to a 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 'InstantiateMyCheckBox

注解

如果Appearance value 设置为Normal, 则CheckBox具有典型的外观。If Appearance value is set to Normal, the CheckBox has a typical appearance. 如果将值设置为Button, 则显示为一个切换按钮, 该按钮可切换到 "向上" 或 "向下" CheckBox状态。If the value is set to Button, the CheckBox appears like a toggle button, which can be toggled to an up or down state.

适用于

另请参阅