CheckBox.Appearance 属性

定义

获取或设置确定 CheckBox 控件外观的值。

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

Appearance 值之一。 默认值是 Normal

例外

分配的值不是 Appearance 值之一。

示例

下面的代码示例创建并初始化一个 CheckBox,并为其提供切换按钮的外观、设置为 AutoCheck false 并将其添加到 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

注解

如果 Appearance 值设置为 Normal,则 CheckBox 具有典型的外观。 如果值设置为 ButtonCheckBox 则显示为切换按钮,可将其切换为向上或向下状态。

适用于

另请参阅