RectangleShape 构造函数 (Int32, Int32, Int32, Int32)

初始化 RectangleShape 类的新实例,指定其位置和大小。

命名空间:  Microsoft.VisualBasic.PowerPacks
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

声明
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
)

参数

备注

RectangleShape 控件直接在窗体或容器控件无法显示;必须在 ShapeContainer 对象包含它。 在初始化 RectangleShape后,必须将其 Parent 属性设置为现有 ShapeContainer 或到 ShapeContainer的新实例。

示例

下面的示例创建 ShapeContainerRectangleShape,将其添加到窗体中,并由 90 像素的正方形显示 90 个像素。

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 安全性

请参见

参考

RectangleShape 类

RectangleShape 重载

Microsoft.VisualBasic.PowerPacks 命名空间

其他资源

Line 和 Shape 控件简介 (Visual Studio)

如何:使用 LineShape 控件绘制直线 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控件绘制形状 (Visual Studio)