SimpleShape.SizeChanged Event

 

Occurs when the Size 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 EventHandler SizeChanged
public:
[BrowsableAttribute(true)]
event EventHandler^ SizeChanged {
    void add(EventHandler^ value);
    void remove(EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member SizeChanged : IEvent<EventHandler,
    EventArgs>
<BrowsableAttribute(True)>
Public Event SizeChanged As EventHandler

Remarks

This event is raised if the Size property is changed by either a programmatic modification or user interaction.

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

Examples

The following example shows how to respond to the SizeChanged event in an event handler. This example requires that you have two RectangleShape controls named RectangleShape1 and RectangleShape2 on a form.

private void rectangleShape1_SizeChanged(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);
    }
}
Private Sub RectangleShape1_SizeChanged() Handles RectangleShape1.SizeChanged
    ' 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

See Also

SimpleShape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)

Return to top