RadioButton.Checked 属性

定义

获取或设置一个值,该值指示是否已选中控件。

public:
 property bool Checked { bool get(); void set(bool value); };
public bool Checked { get; set; }
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.SettingsBindable(true)]
public bool Checked { get; set; }
member this.Checked : bool with get, set
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.SettingsBindable(true)>]
member this.Checked : bool with get, set
Public Property Checked As Boolean

属性值

Boolean

若选中了复选框,则为 true;反之,则为 false

属性

示例

下面的代码示例计算所选 ListBox 内容和 Checked 属性 RadioButton。 从列表框中选择指定项时, PerformClick 将调用另一项 RadioButton 的方法。 此示例要求在窗体上实例化两 RadioButton 个控件和一个 ListBox 控件。

private:
   void ClickMyRadioButton()
   {
      // If Item1 is selected and radioButton2 
      // is checked, click radioButton1.
      if ( listBox1->Text == "Item1" && radioButton2->Checked )
      {
         radioButton1->PerformClick();
      }
   }
private void ClickMyRadioButton()
{
   // If Item1 is selected and radioButton2 
   // is checked, click radioButton1.
   if (listBox1.Text == "Item1" && radioButton2.Checked)
   {
      radioButton1.PerformClick();
   }
}
Private Sub ClickMyRadioButton()
    ' If Item1 is selected and radioButton2 
    ' is checked, click radioButton1.
    If (listBox1.Text = "Item1") And radioButton2.Checked Then
        radioButton1.PerformClick()
    End If
End Sub

适用于