Shape.Move Event

 

Occurs when the shape is moved.

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

Syntax

[BrowsableAttribute(true)]
public event EventHandler Move
public:
[BrowsableAttribute(true)]
event EventHandler^ Move {
    void add(EventHandler^ value);
    void remove(EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member Move : IEvent<EventHandler,
    EventArgs>
<BrowsableAttribute(True)>
Public Event Move As EventHandler

Remarks

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.

Examples

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.
    {
        ovalShape1.BringToFront();
    }
}
Private Sub OvalShape1_Move() Handles OvalShape1.Move
    Dim rect As New Rectangle
    ' Get the bounding rectangle for the rectangle shape.
    rect = RectangleShape1.DisplayRectangle
    ' Determine whether the bounding rectangles overlap.
    If rect.IntersectsWith(OvalShape1.DisplayRectangle) Then
        ' Bring the oval shape to the front.
        OvalShape1.BringToFront()
    End If
End Sub

See Also

Shape Class
Microsoft.VisualBasic.PowerPacks Namespace
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
Introduction to the Line and Shape Controls (Visual Studio)

Return to top