OvalShape Constructor
Initializes a new instance of the OvalShape class.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'宣告
Public Sub New
public OvalShape()
public:
OvalShape()
new : unit -> OvalShape
public function OvalShape()
Remarks
An OvalShape control cannot be displayed directly on a form or container control; it must be contained in a ShapeContainer object. After you initialize an OvalShape, you will have to set its Parent property either to an existing ShapeContainer or to a new instance of ShapeContainer.
Examples
The following example creates a ShapeContainer and an OvalShape, adds them to a form, and displays a circle.
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;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks Namespace
Other Resources
Introduction to the Line and Shape Controls (Visual Studio)
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)