Compartir a través de


SimpleShape.DisplayRectangle (Propiedad)

obtiene el rectángulo que representa el área de presentación de la forma.

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

Sintaxis

'Declaración
<BrowsableAttribute(False)> _
Public ReadOnly Property DisplayRectangle As Rectangle
[BrowsableAttribute(false)]
public Rectangle DisplayRectangle { get; }
[BrowsableAttribute(false)]
public:
property Rectangle DisplayRectangle {
    Rectangle get ();
}
[<BrowsableAttribute(false)>]
member DisplayRectangle : Rectangle
function get DisplayRectangle () : Rectangle

Valor de propiedad

Tipo: System.Drawing.Rectangle
Rectangle que representa el área de presentación de la forma.

Comentarios

Se puede llamar al método de SetBounds para cambiar la propiedad de DisplayRectangle en una única operación.

Ejemplos

El ejemplo siguiente se muestra cómo utilizar el método de DisplayRectangle para determinar si dos formas superpuestas.Este ejemplo requiere tener dos controles de OvalShape denominados OvalShape1 y OvalShape2 en un formulario.Para obtener los mejores resultados, coloque los controles para que se superpongan.

Private Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Get the DisplayRectangle for each OvalShape.
    Dim rect1 As Rectangle = OvalShape1.DisplayRectangle
    Dim rect2 As Rectangle = OvalShape2.DisplayRectangle
    ' If the DisplayRectangles intersect, move OvalShape2.
    If rect1.IntersectsWith(rect2) Then
        OvalShape2.SetBounds(rect1.Right, rect1.Bottom, 
          rect2.Width, rect2.Height)
    End If
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Get the DisplayRectangle for each OvalShape.
    Rectangle rect1 = ovalShape1.DisplayRectangle;
    Rectangle rect2 = ovalShape2.DisplayRectangle;
    // If the DisplayRectangles intersect, move OvalShape2.
    if (rect1.IntersectsWith(rect2))
    {
        ovalShape2.SetBounds(rect1.Right, rect1.Bottom, rect2.Width, rect2.Height);
    }
}

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)