OvalShape 建構函式 (Int32, Int32, Int32, Int32)
初始化 OvalShape 類別的新執行個體,並指定其位置和大小。
命名空間: 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 OvalShape(
int left,
int top,
int width,
int height
)
public:
OvalShape(
int left,
int top,
int width,
int height
)
new :
left:int *
top:int *
width:int *
height:int -> OvalShape
public function OvalShape(
left : int,
top : int,
width : int,
height : int
)
參數
- left
類型:Int32
- top
類型:Int32
width
類型:Int32Integer,表示 OvalShape 的寬度 (以像素為單位)。
height
類型:Int32Integer,表示 OvalShape 的高度 (以像素為單位)。
備註
OvalShape 控制項直接在表單或容器控制項無法顯示;必須在 ShapeContainer 包含它的物件。 在初始化 OvalShape後,您必須將其 Parent 屬性加入至現有的 ShapeContainer 或 ShapeContainer的新執行個體。
範例
下列範例建立 ShapeContainer 和 OvalShape,將它們加入至表單,再顯示一個 100 像素直徑圓形。
Private Sub DrawCircle2()
Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
' Declare an OvalShape and set the location and size.
Dim oval1 As New Microsoft.VisualBasic.PowerPacks.OvalShape(20, 20,
120, 120)
' Set the form as the parent of the ShapeContainer.
canvas.Parent = Me
' Set the ShapeContainer as the parent of the OvalShape.
oval1.Parent = canvas
End Sub
private void DrawCircle2()
{
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
// Declare an OvalShape and set the location and size.
Microsoft.VisualBasic.PowerPacks.OvalShape oval1 =
new Microsoft.VisualBasic.PowerPacks.OvalShape(20, 20, 120, 120);
// Set the form as the parent of the ShapeContainer.
canvas.Parent = this;
// Set the ShapeContainer as the parent of the OvalShape.
oval1.Parent = canvas;
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)