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)

public OvalShape(
	ShapeContainer parent


Type: Microsoft.VisualBasic.PowerPacks.ShapeContainer

A ShapeContainer in which the OvalShape will be contained.

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.

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 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;
Return to top