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 with get
function get DisplayRectangle () : Rectangle
Valor de propriedade
Tipo: Rectangle
Um 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 dois 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
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de código parcialmente confiável.
Consulte também
Referência
Namespace Microsoft.VisualBasic.PowerPacks
Outros recursos
Introdução aos controles de linha e forma (Visual Studio)
Como desenhar linhas com o controle LineShape (Visual Studio)
Como desenhar formas com os controles OvalShape e RectangleShape (Visual Studio)