OvalShape 類別
更新:2007 年 11 月
表示顯示為圓形和橢圓形的控制項。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
<ToolboxBitmapAttribute(GetType(OvalShape), "Microsoft.VisualBasic.PowerPacks.OvalShape.bmp")> _
Public Class OvalShape _
Inherits SimpleShape
Dim instance As OvalShape
[ToolboxBitmapAttribute(typeof(OvalShape), "Microsoft.VisualBasic.PowerPacks.OvalShape.bmp")]
public class OvalShape : SimpleShape
[ToolboxBitmapAttribute(typeof(OvalShape), L"Microsoft.VisualBasic.PowerPacks.OvalShape.bmp")]
public ref class OvalShape : public SimpleShape
public class OvalShape extends SimpleShape
備註
在設計階段或執行階段,OvalShape 控制項都可讓您在表單或容器 (Container) 上繪製圓形和橢圓形。
當您將 Line 或 Shape 控制項加入至表單或容器時,會建立隱藏的 ShapeContainer 物件。ShapeContainer 會做為每個容器控制項內形狀的繪圖介面。每個 ShapeContainer 都有對應的 ShapeCollection,可讓您逐一查看 ShapeContainer 中包含的 Line 和 Shape 控制項。
當您在執行階段建立 OvalShape 控制項時,也必須建立 ShapeContainer,並將 OvalShape 的 Parent 屬性設定為 ShapeContainer。
範例
下列範例會建立 ShapeContainer 和 OvalShape,然後將它們加入至表單,再顯示圓形。
Private Sub DrawCircle()
Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
Dim oval1 As New Microsoft.VisualBasic.PowerPacks.OvalShape
' Set the form as the parent of the ShapeContainer.
canvas.Parent = Me
' Set the ShapeContainer as the parent of the OvalShape.
oval1.Parent = canvas
' Set the location and size of the circle.
oval1.Left = 10
oval1.Top = 10
oval1.Width = 100
oval1.Height = 100
End Sub
private void DrawCircle1()
{
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
Microsoft.VisualBasic.PowerPacks.OvalShape oval1 =
new Microsoft.VisualBasic.PowerPacks.OvalShape();
// Set the form as the parent of the ShapeContainer.
canvas.Parent = this;
// Set the ShapeContainer as the parent of the OvalShape.
oval1.Parent = canvas;
// Set the location and size of the circle.
oval1.Left = 10;
oval1.Top = 10;
oval1.Width = 100;
oval1.Height = 100;
}
繼承階層架構
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Microsoft.VisualBasic.PowerPacks.Shape
Microsoft.VisualBasic.PowerPacks.SimpleShape
Microsoft.VisualBasic.PowerPacks.OvalShape
執行緒安全
這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)
HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)
HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)