SimpleShape.LocationChanged Event
Occurs when the Location property of a shape is changed.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'إقرار
<BrowsableAttribute(True)> _
Public Event LocationChanged As EventHandler
'الاستخدام
Dim instance As SimpleShape
Dim handler As EventHandler
AddHandler instance.LocationChanged, handler
[BrowsableAttribute(true)]
public event EventHandler LocationChanged
[BrowsableAttribute(true)]
public:
event EventHandler^ LocationChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member LocationChanged : IEvent<EventHandler,
EventArgs>
JScript does not support events.
Remarks
This event is raised if the Location property is changed by either a programmatic modification or user interaction.
For more information about how to handle events, see Consuming Events.
Examples
The following example shows how to respond to the LocationChanged event in an event handler. This example requires that you have two RectangleShape controls named RectangleShape1 and RectangleShape2 on a form.
Private Sub RectangleShape1_LocationChanged(
) Handles RectangleShape1.LocationChanged
' If the second rectangle intersects with the first, move it.
If RectangleShape1.ClientRectangle.IntersectsWith(
RectangleShape2.ClientRectangle) Then
RectangleShape2.Location = New Point(RectangleShape1.Right,
RectangleShape1.Bottom)
End If
End Sub
private void rectangleShape1_LocationChanged(object sender, System.EventArgs e)
{
// If the second rectangle intersects with the first, move it.
if (rectangleShape1.ClientRectangle.IntersectsWith(rectangleShape2.ClientRectangle))
{
rectangleShape2.Location = new Point(rectangleShape1.Right,
rectangleShape1.Bottom);
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks Namespace
Other Resources
Introduction to the Line and Shape Controls (Visual Studio)
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)