Partilhar via


Construtor RectangleShape (Int32, Int32, Int32, Int32)

Inicializa uma nova instância da RectangleShape classe, especificando o local e tamanho.

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

Sintaxe

'Declaração
Public Sub New ( _
    left As Integer, _
    top As Integer, _
    width As Integer, _
    height As Integer _
)
public RectangleShape(
    int left,
    int top,
    int width,
    int height
)
public:
RectangleShape(
    int left, 
    int top, 
    int width, 
    int height
)
new : 
        left:int * 
        top:int * 
        width:int * 
        height:int -> RectangleShape
public function RectangleShape(
    left : int, 
    top : int, 
    width : int, 
    height : int
)

Parâmetros

Comentários

A RectangleShape controle não pode ser exibida diretamente em um controle de formulário ou recipiente; ele deve estar contido em um ShapeContainer objeto.Depois que você inicializa um RectangleShape, você terá que definir seu Parent propriedade a um existente ShapeContainer ou para uma nova instância do ShapeContainer.

Exemplos

O exemplo a seguir cria um ShapeContainer e um RectangleShape, adiciona-los a um formulário e exibe um pixel 90 90 pixel quadrado.

Private Sub DrawSquare()
    Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
    ' Declare a RectangleShape and set the location and size.
    Dim rect1 As New Microsoft.VisualBasic.PowerPacks.
        RectangleShape(15, 15, 105, 105)
    ' Set the form as the parent of the ShapeContainer.
    canvas.Parent = Me
    ' Set the ShapeContainer as the parent of the RectangleShape.
    rect1.Parent = canvas
End Sub
private void DrawSquare()
{
    Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas = 
        new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
    // Declare a RectangleShape and set the location and size.
    Microsoft.VisualBasic.PowerPacks.RectangleShape rect1 = 
        new Microsoft.VisualBasic.PowerPacks.RectangleShape(15, 15, 105, 105);
    // Set the form as the parent of the ShapeContainer.
    canvas.Parent = this;
    // Set the ShapeContainer as the parent of the RectangleShape.
    rect1.Parent = canvas;
}

Segurança do .NET Framework

Consulte também

Referência

RectangleShape Classe

Sobrecargas RectangleShape

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