共用方式為


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 專案的 方法。 此範例要求兩 RadioButtonListBox 控制項和 已在表單上具現化。

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

適用於