RectangleShape 建構函式
初始化 RectangleShape 類別的新執行個體。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
Public Sub New
public RectangleShape()
public:
RectangleShape()
new : unit -> RectangleShape
public function RectangleShape()
備註
RectangleShape 控制項直接在表單或容器控制項無法顯示;必須在 ShapeContainer 包含它的物件。 在初始化 RectangleShape後,您必須將其 Parent 屬性加入至現有的 ShapeContainer 或 ShapeContainer的新執行個體。
範例
下列範例建立 ShapeContainer 和 RectangleShape,將它們加入至表單,再顯示矩形。
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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)