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

'Declaration
<BrowsableAttribute(True)> _
Public Event Move As EventHandler
[BrowsableAttribute(true)]
public event EventHandler Move
[BrowsableAttribute(true)]
public:
 event EventHandler^ Move {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member Move : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

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 Consuming 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 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
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();
    }
}

.NET Framework Security

See Also

Reference

Shape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

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)