Freigeben über


RectangleShape-Konstruktor (Int32, Int32, Int32, Int32)

Initialisiert eine neue Instanz der RectangleShape-Klasse, die Position und Größe angibt.

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

Syntax

'Declaration
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
)

Parameter

  • left
    Typ: Int32
  • top
    Typ: Int32
  • width
    Typ: Int32

    Eine Integer, die die Breite (in Pixel) der RectangleShape darstellt.

  • height
    Typ: Int32

    Eine Integer, die die Höhe der RectangleShape in Pixel darstellt.

Hinweise

Ein RectangleShape-Steuerelement kann nicht direkt auf ein Formular oder ein Containersteuerelement angezeigt werden; muss in einem ShapeContainer-Objekt enthalten sind. Nachdem Sie RectangleShape initialisieren, müssen Sie seine Parent-Eigenschaft entweder auf ein vorhandenes ShapeContainer oder auf eine neue Instanz von ShapeContainer festlegen.

Beispiele

Im folgenden Beispiel wird ShapeContainer und RectangleShape, wird ihnen ein Formular hinzu und zeigt ein 90 Pixel vom Quadrat mit 90 Pixel an.

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

.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)