Export (0) Print
Expand All

Control.Move Event

Occurs when the control is moved.

[Visual Basic]
Public Event Move As EventHandler
[C#]
public event EventHandler Move;
[C++]
public: __event EventHandler* Move;

[JScript] In JScript, you can handle the events defined by a class, but you cannot define your own.

Event Data

The event handler receives an argument of type EventArgs.

Remarks

For more information about handling events, see Consuming Events.

Example

[Visual Basic] 
' 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

[C#] 
// 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();
}

[C++] 
// 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( S"Form screen position = {0}", __box(this->Location));
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Control Class | Control Members | System.Windows.Forms Namespace | OnMove

Show:
© 2014 Microsoft