Control.OnMove(EventArgs) メソッド

定義

Move イベントを発生させます。

protected:
 virtual void OnMove(EventArgs ^ e);
protected virtual void OnMove(EventArgs e);
abstract member OnMove : EventArgs -> unit
override this.OnMove : EventArgs -> unit
Protected Overridable Sub OnMove (e As EventArgs)

パラメーター

e
EventArgs

イベント データを含む EventArgs

次のコード例では、 Move イベントを使用して、フォームのキャプション バーにフォームの位置を画面座標で表示します。

   // The following example displays the location of the form in screen coordinates
   // on the caption bar of the form.
private:
   void Form1_Move( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      this->Text = String::Format( "Form screen position = {0}", this->Location );
   }
// The following example displays the location of the form in screen coordinates
// on the caption bar of the form.
private void Form1_Move(object sender, System.EventArgs e)
{
    this.Text = "Form screen position = " + this.Location.ToString();
}
' The following example displays the location of the form in screen coordinates
' on the caption bar of the form.
Private Sub Form1_Move(sender As Object, e As System.EventArgs) Handles MyBase.Move
    Me.Text = "Form screen position = " + Me.Location.ToString()
End Sub

注釈

イベントを発生させると、デリゲートを介してイベント ハンドラーが呼び出されます。 詳細については、「イベントの 処理と発生」を参照してください。

OnMove メソッドでは、デリゲートをアタッチせずに、派生クラスでイベントを処理することもできます。 これは、派生クラスでイベントを処理するために推奨される手法です。

注意 (継承者)

派生クラスで OnMove(EventArgs) をオーバーライドする場合は、登録されているデリゲートがイベントを受け取るように、基底クラスの OnMove(EventArgs) メソッドを必ず呼び出してください。

適用対象

こちらもご覧ください