RectangleShape-Konstruktor

Initialisiert eine neue Instanz der RectangleShape-Klasse.

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

Syntax

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

Hinweise

Ein RectangleShape-Steuerelement kann nicht direkt auf einem Formular oder einem Containersteuerelement angezeigt werden. Es muss sich in einem ShapeContainer-Objekt enthalten sind.Nachdem Sie RectangleShapeinitialisieren, müssen Sie deren Parent-Eigenschaft entweder auf vorhandenen ShapeContainer oder einer neuen Instanz von ShapeContainerfestlegen.

Beispiele

Im folgenden Beispiel wird ShapeContainer und RectangleShape, fügt sie einem Formular hinzu und zeigt ein Rechteck.

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

.NET Framework-Sicherheit

Siehe auch

Referenz

RectangleShape Klasse

RectangleShape-Überladung

Microsoft.VisualBasic.PowerPacks-Namespace

Weitere Ressourcen

Einführung in das Line-Steuerelement und das Shape-Steuerelement (Visual Studio)

Gewusst wie: Zeichnen von Linien mit dem LineShape-Steuerelement (Visual Studio)

Gewusst wie: Zeichnen von Formen mit dem OvalShape-Steuerelement und dem RectangleShape-Steuerelement (Visual Studio)