Propriedade SimpleShape.DisplayRectangle

Obtém o retângulo que representa a área de exibição da forma.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (em Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintaxe

'Declaração
<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 propriedade

Tipo: System.Drawing.Rectangle
A Rectangle que representa a área de exibição da forma.

Comentários

Você pode chamar o SetBounds método para alterar o DisplayRectangle propriedade em uma única operação.

Exemplos

O exemplo a seguir mostra como usar o DisplayRectangle método para determinar se duas formas de sobreposição.Este exemplo requer que você tenha duas OvalShape controles denominados OvalShape1 e OvalShape2 em um formulário.Para obter melhores resultados, posicione os controles para que eles se sobreponham.

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

Segurança do .NET Framework

Consulte também

Referência

SimpleShape Classe

Namespace Microsoft.VisualBasic.PowerPacks

Outros recursos

Introdução à linha e controles Shape (Visual Studio)

Como: desenhar linhas com o controle de LineShape (Visual Studio)

Como: desenhar formas com os controles de RectangleShape (Visual Studio) e o OvalShape