Export (0) Print
Expand All

OvalShape Constructor (Int32, Int32, Int32, Int32)

Initializes a new instance of the OvalShape class, specifying its location and size.

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

public OvalShape(
	int left,
	int top,
	int width,
	int height
)

Parameters

left
Type: System.Int32
top
Type: System.Int32
width
Type: System.Int32

An Integer representing the width (in pixels)of the OvalShape.

height
Type: System.Int32

An Integer representing the height (in pixels)of the OvalShape.

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.

The following example creates a ShapeContainer and an OvalShape, adds them to a form, and displays a 100 pixel diameter circle.

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;
}

Show:
© 2014 Microsoft