Partilhar via


Propriedade SimpleShape.Size

Obtém ou define a altura e a largura da forma.

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

Sintaxe

'Declaração
<BrowsableAttribute(True)> _
Public Property Size As Size
[BrowsableAttribute(true)]
public Size Size { get; set; }
[BrowsableAttribute(true)]
public:
property Size Size {
    Size get ();
    void set (Size value);
}
[<BrowsableAttribute(true)>]
member Size : Size with get, set
function get Size () : Size 
function set Size (value : Size)

Valor de propriedade

Tipo: Size
O Size que representa a altura e a largura da forma em pixels.

Comentários

O Width e Height propriedades representam a largura e a altura da forma. Você pode usar o Size propriedade para obter o tamanho da forma para tarefas como desenhar na superfície da forma.

Como SimpleShape não tem nenhuma área não cliente, o ClientSize e Size propriedades são as mesmas.

Exemplos

O exemplo a seguir demonstra como usar o Size propriedade para redimensionar um OvalShape controle. Este exemplo requer que você tenha um OvalShape controle denominado OvalShape1 em um formulário.

Private Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Declare a Size 20 pixels wider and taller than the current Size. 
    Dim sz As New System.Drawing.Size(OvalShape1.Width + 20, 
      OvalShape1.Height + 20)
    ' Change the Size.
    OvalShape1.Size = sz
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Declare a Size 20 pixels wider and taller than the current Size.
    System.Drawing.Size sz = new System.Drawing.Size(ovalShape1.Width + 20, 
        ovalShape1.Height + 20);
    // Change the Size.
    ovalShape1.Size = sz;
}

Segurança do .NET Framework

Consulte também

Referência

SimpleShape Classe

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)