RadioButton.Checked RadioButton.Checked RadioButton.Checked RadioButton.Checked Property

定义

获取或设置一个值,该值指示是否已选中控件。Gets or sets a value indicating whether the control is checked.

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

属性值

若选中了复选框,则为 true;反之,则为 falsetrue if the check box is checked; otherwise, false.

示例

下面的代码示例计算ListBox一个选择Checked和的属性RadioButtonThe following code example evaluates a ListBox selection and the Checked property of a RadioButton. 从列表框中选择指定项时, PerformClick将调用另一个RadioButton的方法。When a specified item is selected from the list box, the PerformClick method of another RadioButton is called. 此示例要求在窗RadioButton体上实例ListBox化两个控件和。This example requires that two RadioButton controls and a ListBox have been instantiated on a form.

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

适用于