Condividi tramite


Costruttore RectangleShape

Inizializza una nuova istanza di RectangleShape classe.

Spazio dei nomi:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintassi

'Dichiarazione
Public Sub New
public RectangleShape()
public:
RectangleShape()
new : unit -> RectangleShape
public function RectangleShape()

Note

In RectangleShape il controllo non può essere visualizzata direttamente su un form o un controllo contenitore, deve essere contenuto in un oggetto ShapeContainer oggetto.Dopo avere inizializzato un oggetto RectangleShape, sarà necessario impostarne Parent proprietà o a un oggetto esistente ShapeContainer o a una nuova istanza di ShapeContainer.

Esempi

Nell'esempio seguente viene creato un oggetto ShapeContainer e RectangleShape, li aggiunge a un form e visualizzare un rettangolo.

Private Sub DrawRectangle()
    Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
    Dim rect1 As New Microsoft.VisualBasic.PowerPacks.RectangleShape
    ' Set the form as the parent of the ShapeContainer.
    canvas.Parent = Me
    ' Set the ShapeContainer as the parent of the RectangleShape.
    rect1.Parent = canvas
    ' Set the location and size of the rectangle.
    rect1.Left = 10
    rect1.Top = 10
    rect1.Width = 300
    rect1.Height = 100
End Sub
private void DrawRectangle()
{
    Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas = 
        new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
    Microsoft.VisualBasic.PowerPacks.RectangleShape rect1 = 
        new Microsoft.VisualBasic.PowerPacks.RectangleShape();
    // Set the form as the parent of the ShapeContainer.
    canvas.Parent = this;
    // Set the ShapeContainer as the parent of the RectangleShape.
    rect1.Parent = canvas;
    // Set the location and size of the rectangle.
    rect1.Left = 10;
    rect1.Top = 10;
    rect1.Width = 300;
    rect1.Height = 100;
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

RectangleShape Classe

Overload RectangleShape

Spazio dei nomi Microsoft.VisualBasic.PowerPacks

Altre risorse

Introduzione ai controlli Line e Shape (Visual Studio)

Procedura: disegnare linee con il controllo LineShape (Visual Studio)

Procedura: disegnare forme con i controlli OvalShape e RectangleShape (Visual Studio)