Shape.Move Event


Occurs when the shape is moved.

Namespace:   Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public event EventHandler Move

The Move event occurs only when a shape's location changes with regard to its container, not when the container is moved.

For more information about how to handle events, see Handling and Raising Events.

The following example shows how to respond to the Move event in an event handler. This example requires that you have an OvalShape control named OvalShape1 and a RectangleShape control named RectangleShape1 on a form.

private void ovalShape1_Move(object sender, System.EventArgs e)
    Rectangle rect = new Rectangle();
    // Get the bounding rectangle for the rectangle shape.
    rect = rectangleShape1.DisplayRectangle;
    // Determine whether the bounding rectangles overlap.
    if (rect.IntersectsWith(ovalShape1.DisplayRectangle))
    // Bring the oval shape to the front.
Return to top