OvalShape Constructor (ShapeContainer)

Initializes a new instance of the OvalShape class, specifying the ShapeContainer in which it will be contained.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Sub New ( _
    parent As ShapeContainer _
)
public OvalShape(
    ShapeContainer parent
)
public:
OvalShape(
    ShapeContainer^ parent
)
new : 
        parent:ShapeContainer -> OvalShape
public function OvalShape(
    parent : ShapeContainer
)

Parameters

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.

When you add an OvalShape to a form or container that already contains a ShapeContainer, you should use the existing ShapeContainer instead of declaring a new one. Hosting more than one ShapeContainer on a form or container can cause unexpected results with z-order and events.

Examples

The following example creates an OvalShape and adds it to a form that already contains a LineShape. This example requires that you have a LineShape named LineShape1 on a form.

Private Sub DrawOval()
    ' Declare an OvalShape and parent it to LineShape1's ShapeContainer. 
    Dim oval1 As New Microsoft.VisualBasic.PowerPacks.
      OvalShape(LineShape1.Parent)
    ' Set the location and size of the oval.
    oval1.Left = 10
    oval1.Top = 10
    oval1.Width = 100
    oval1.Height = 200
End Sub
private void DrawOval()
{
    // Declare an OvalShape and parent it to LineShape1's ShapeContainer.
    Microsoft.VisualBasic.PowerPacks.OvalShape oval1 = 
        new Microsoft.VisualBasic.PowerPacks.OvalShape(lineShape1.Parent);
    // Set the location and size of the oval.
    oval1.Left = 10;
    oval1.Top = 10;
    oval1.Width = 100;
    oval1.Height = 200;
}

.NET Framework Security

See Also

Reference

OvalShape Class

OvalShape Overload

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)