Compartir a través de


SimpleShape.LocationChanged (Evento)

Tiene lugar cuando cambia la propiedad Location de una forma.

Espacio de nombres:  Microsoft.VisualBasic.PowerPacks
Ensamblado:  Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintaxis

'Declaración
<BrowsableAttribute(True)> _
Public Event LocationChanged As EventHandler
[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 no admite eventos.

Comentarios

Este evento se produce si el Location propiedad se modifica mediante programación o por la interacción del usuario.

Para obtener más información acerca de cómo controlar eventos, vea Controlar y provocar eventos.

Ejemplos

En el ejemplo siguiente se muestra cómo responder a la LocationChanged evento en un controlador de eventos. Este ejemplo requiere que haya dos RectangleShape controles denominados RectangleShape1 y RectangleShape2 en un formulario.

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

Seguridad de .NET Framework

Vea también

Referencia

SimpleShape Clase

Microsoft.VisualBasic.PowerPacks (Espacio de nombres)

Otros recursos

Introducción a los controles de líneas y formas (Visual Studio)

Cómo: Dibujar líneas con el control LineShape (Visual Studio)

Cómo: Dibujar formas con los controles OvalShape y RectangleShape (Visual Studio)