Button.PerformClick メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)



他のボタンの Click イベントが発生したときに、一回おきに Button の Click イベントを生成するコード例を次に示します。このコードは、2 つの Button コントロールがフォーム上でインスタンス化され、myVar という名前のメンバ変数がクラス内の 32 ビット符号付き整数として宣言されていることを前提にしています。
Private Sub button1_Click(sender As Object, e As EventArgs) ' If myVar is an even number, click Button2. If myVar Mod 2 = 0 Then button2.PerformClick() ' Display the status of Button2's Click event. MessageBox.Show("button2 was clicked ") Else ' Display the status of Button2's Click event. MessageBox.Show("button2 was NOT clicked") End If ' Increment myVar. myVar = myVar + 1 End Sub 'button1_Click
private void button1_Click (Object sender, EventArgs e) { // If myVar is an even number, click Button2. if(myVar %2 == 0) { button2.PerformClick(); // Display the status of Button2's Click event. MessageBox.Show("button2 was clicked "); } else { // Display the status of Button2's Click event. MessageBox.Show("button2 was NOT clicked"); } // Increment myVar. myVar = myVar + 1; }
private: void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { // If myVar is an even number, click Button2. if ( myVar % 2 == 0 ) { button2->PerformClick(); // Display the status of Button2's Click event. MessageBox::Show( "button2 was clicked " ); } else { // Display the status of Button2's Click event. MessageBox::Show( "button2 was NOT clicked" ); } // Increment myVar. myVar++; }
private void button1_Click(Object sender, EventArgs e) { // If myVar is an even number, click Button2. if (myVar % 2 == 0) { button2.PerformClick(); // Display the status of Button2's Click event. MessageBox.Show("button2 was clicked "); } else { // Display the status of Button2's Click event. MessageBox.Show("button2 was NOT clicked"); } // Increment myVar. myVar = myVar + 1; } //button1_Click
protected function button1_Click (sender : Object, e : EventArgs) { // If myVar is an even number, click Button2. if(myVar %2 == 0) { button2.PerformClick(); // Display the status of Button2's Click event. MessageBox.Show("button2 was clicked "); } else { // Display the status of Button2's Click event. MessageBox.Show("button2 was NOT clicked"); } // Increment myVar. myVar = myVar + 1; }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からButton.PerformClick メソッドを検索する場合は、下記のリンクをクリックしてください。

- Button.PerformClick メソッドのページへのリンク