Dela via


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)

Syntax

'Declaration
Public Sub New ( _
    left As Integer, _
    top As Integer, _
    width As Integer, _
    height As Integer _
)
public OvalShape(
    int left,
    int top,
    int width,
    int height
)
public:
OvalShape(
    int left, 
    int top, 
    int width, 
    int height
)
new : 
        left:int * 
        top:int * 
        width:int * 
        height:int -> OvalShape
public function OvalShape(
    left : int, 
    top : int, 
    width : int, 
    height : int
)

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.

Examples

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

Private Sub DrawCircle2()
    Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
    ' Declare an OvalShape and set the location and size.
    Dim oval1 As New Microsoft.VisualBasic.PowerPacks.OvalShape(20, 20,
      120, 120)
    ' Set the form as the parent of the ShapeContainer.
    canvas.Parent = Me
    ' Set the ShapeContainer as the parent of the OvalShape.
    oval1.Parent = canvas
End Sub
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;
}

.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)