次の方法で共有


CheckBox コンストラクタ

CheckBox クラスの新しいインスタンスを初期化します。

Public Sub New()
[C#]
public CheckBox();
[C++]
public: CheckBox();
[JScript]
public function CheckBox();

解説

既定では、新しい CheckBox がインスタンス化されると、 AutoChecktrue に、 Checkedfalse に、 AppearanceNormal に、それぞれ設定されます。

使用例

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 ファミリ, .NET Compact Framework - Windows CE .NET

参照

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