RadioButton.PerformClick 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为控件生成事件 Click ,模拟用户的单击。
public:
void PerformClick();
public void PerformClick();
member this.PerformClick : unit -> unit
Public Sub PerformClick ()
示例
下面的代码示例计算所选 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