次の方法で共有


CheckBox.Appearance プロパティ

チェック ボックス コントロールの外観を決定する値を取得または設定します。

Public Property Appearance As Appearance
[C#]
public Appearance Appearance {get; set;}
[C++]
public: __property Appearance get_Appearance();public: __property void set_Appearance(Appearance);
[JScript]
public function get Appearance() : Appearance;public function set Appearance(Appearance);

プロパティ値

Appearance 値の 1 つ。既定値は、 Normal です。

例外

例外の種類 条件
InvalidEnumArgumentException 代入された値が、 Appearance 値ではありません。

解説

Appearance 値を Appearance.Normal に設定すると、チェック ボックスは通常の外観となります。値を Button に設定すると、チェック ボックスの外観がトグル ボタンのように表示され、状態に合わせてオンとオフを切り替えます。

使用例

CheckBox を作成および初期化し、トグル ボタンの外観を生成する例を次に示します。 AutoCheckfalse に設定し、トグル ボタンを Form に追加します。

 
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

[C#] 
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);
 }
 

[C++] 
public:
    void InstantiateMyCheckBox() {
        // Create and initialize a CheckBox.   
        CheckBox __gc *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.
        this->Controls->Add(checkBox1);
    };
 

[JScript] 
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);
 }
 

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

CheckBox クラス | CheckBox メンバ | System.Windows.Forms 名前空間 | Appearance