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

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 Sub New (
    left As Integer,
    top As Integer,
    width As Integer,
    height As Integer
)

Parameters

  • x
    An Integer representing the left edge (in pixels)of the OvalShape.
  • y
    An Integer representing the top edge (in pixels) of the 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 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;
}
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

See Also

OvalShape Overload
OvalShape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)

Return to top