OvalShape Class

Represents a control displayed as a circle or oval.

Inheritance Hierarchy

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      Microsoft.VisualBasic.PowerPacks.Shape
        Microsoft.VisualBasic.PowerPacks.SimpleShape
          Microsoft.VisualBasic.PowerPacks.OvalShape

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

Syntax

'Declaração
<ToolboxBitmapAttribute(GetType(OvalShape), "Microsoft.VisualBasic.PowerPacks.OvalShape.bmp")> _
Public Class OvalShape _
    Inherits SimpleShape
[ToolboxBitmapAttribute(typeof(OvalShape), "Microsoft.VisualBasic.PowerPacks.OvalShape.bmp")]
public class OvalShape : SimpleShape
[ToolboxBitmapAttribute(typeof(OvalShape), L"Microsoft.VisualBasic.PowerPacks.OvalShape.bmp")]
public ref class OvalShape : public SimpleShape
[<ToolboxBitmapAttribute(typeof(OvalShape), "Microsoft.VisualBasic.PowerPacks.OvalShape.bmp")>]
type OvalShape =  
    class
        inherit SimpleShape
    end
public class OvalShape extends SimpleShape

The OvalShape type exposes the following members.

Constructors

  Name Description
Public method OvalShape() Initializes a new instance of the OvalShape class.
Public method OvalShape(ShapeContainer) Initializes a new instance of the OvalShape class, specifying the ShapeContainer in which it will be contained.
Public method OvalShape(Int32, Int32, Int32, Int32) Initializes a new instance of the OvalShape class, specifying its location and size.

Top

Properties

  Name Description
Public property AccessibilityObject Gets the AccessibleObject that is assigned to the control. (Inherited from Shape.)
Public property AccessibleDefaultActionDescription Gets or sets the default action description of the control for use by accessibility client applications. (Inherited from Shape.)
Public property AccessibleDescription Gets or sets the description of the control that is used by accessibility client applications. (Inherited from Shape.)
Public property AccessibleName Gets or sets the name of the control that is used by accessibility client applications. (Inherited from Shape.)
Public property AccessibleRole Gets or sets the accessible role of the control. (Inherited from Shape.)
Public property Anchor Gets or sets the edges of the container to which a shape is bound, and determines how a shape is resized when its parent is resized. (Inherited from Shape.)
Public property BackColor Gets or sets the background color for the shape. (Inherited from SimpleShape.)
Public property BackgroundImage Gets or sets the image displayed in the shape. (Inherited from SimpleShape.)
Public property BackgroundImageLayout Gets or sets the background image layout as defined in the ImageLayout enumeration. (Inherited from SimpleShape.)
Public property BackStyle Gets or sets the transparency of the shape. (Inherited from SimpleShape.)
Public property BorderColor Gets or sets the color of the border of a shape or line control. (Inherited from Shape.)
Public property BorderStyle Gets or sets the border style for a shape or line control. (Inherited from Shape.)
Public property BorderWidth Gets or sets the width of the shape control's border. (Inherited from SimpleShape.)
Public property Bottom Gets the distance, in pixels, between the bottom edge of the shape and the top edge of its container's client area. (Inherited from SimpleShape.)
Public property Bounds Gets or sets the size and location of the shape in pixels, relative to the parent control. (Inherited from SimpleShape.)
Public property CanFocus Gets a value indicating whether a line or shape control can receive focus. (Inherited from Shape.)
Protected property CanRaiseEvents Gets a value indicating whether the component can raise an event. (Inherited from Component.)
Public property CanSelect Gets a value indicating whether a line or shape control can be selected. (Inherited from Shape.)
Public property ClientRectangle Gets the rectangle that represents the client area of the shape. (Inherited from SimpleShape.)
Public property ClientSize Gets or sets the height and width of the client area of the shape. (Inherited from SimpleShape.)
Public property Container Gets the IContainer that contains the Component. (Inherited from Shape.)
Public property ContainsFocus Gets a value indicating whether a line or shape control currently has the input focus. (Inherited from Shape.)
Public property ContextMenu Gets or sets the shortcut menu associated with a line or shape control. (Inherited from Shape.)
Public property ContextMenuStrip Gets or sets the ContextMenuStrip associated with a line or shape control. (Inherited from Shape.)
Public property Created Gets a value indicating whether a line or shape control has been created. (Inherited from Shape.)
Public property Cursor Gets or sets the cursor that is displayed when the mouse pointer is resting on a line or shape control. (Inherited from Shape.)
Protected property DesignMode Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Public property DisplayRectangle Gets the rectangle that represents the display area of the shape. (Inherited from SimpleShape.)
Public property Disposing Gets a value indicating whether the base Shape class is disposing. (Inherited from Shape.)
Public property Enabled Gets or sets a value indicating whether a line or shape control can respond to user interaction. (Inherited from Shape.)
Protected property Events Gets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public property FillColor Gets or sets the color that is used to fill the shape. (Inherited from SimpleShape.)
Public property FillGradientColor Gets or sets the gradient color that is used to fill the shape. (Inherited from SimpleShape.)
Public property FillGradientStyle Gets or sets the gradient style that is used to fill the shape. (Inherited from SimpleShape.)
Public property FillStyle Gets or sets the pattern used to fill the shape. (Inherited from SimpleShape.)
Public property Focused Gets a value indicating whether a line or shape control currently has the input focus. (Inherited from Shape.)
Public property Height Gets or sets the height of the shape. (Inherited from SimpleShape.)
Public property IsAccessible Gets or sets a value indicating whether a line or shape control is available to accessibility applications. (Inherited from Shape.)
Public property IsDisposed Gets a value indicating whether a line or shape control has been disposed of. (Inherited from Shape.)
Public property Left Gets or sets the distance, in pixels, between the left edge of the shape and the left edge of its container's client area. (Inherited from SimpleShape.)
Public property Location Gets or sets the coordinates of the upper-left corner of the shape relative to the upper-left corner of its container. (Inherited from SimpleShape.)
Public property Name Gets or sets the name of a line or shape control. (Inherited from Shape.)
Public property Parent Gets or sets the parent container of a line or shape control. (Inherited from Shape.)
Public property Region Gets or sets the window region associated with a line or shape control. (Inherited from Shape.)
Public property Right Gets the distance, in pixels, between the right edge of the shape and the left edge of its container's client area. (Inherited from SimpleShape.)
Public property SelectionColor Gets or sets the selection color of a shape. (Inherited from Shape.)
Public property Site Gets or sets the ISite of the Component. (Inherited from Component.)
Public property Size Gets or sets the height and width of the shape. (Inherited from SimpleShape.)
Public property Tag Gets or sets the object that contains data about a line or shape control. (Inherited from Shape.)
Public property Top Gets or sets the distance, in pixels, between the top edge of the shape and the left edge of its container's client area. (Inherited from SimpleShape.)
Public property UseWaitCursor Gets or sets a value indicating whether to use the wait cursor for the current line or shape control. (Inherited from Shape.)
Public property Visible Gets or sets a value indicating whether a line or shape control is displayed. (Inherited from Shape.)
Public property Width Gets or sets the width of the shape. (Inherited from SimpleShape.)

Top

Methods

  Name Description
Public method BringToFront Brings a line or shape control to the front of the z-order. (Inherited from Shape.)
Protected method CreateAccessibilityInstance Creates a new accessibility object for the shape control. (Inherited from SimpleShape.)
Public method CreateObjRef Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public method Dispose() Releases all resources used by the Component. (Inherited from Component.)
Protected method Dispose(Boolean) Releases the unmanaged resources used by a line or shape control and optionally releases the managed resources. (Inherited from Shape.)
Public method DrawToBitmap Supports rendering to the specified bitmap. (Inherited from SimpleShape.)
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public method FindForm Retrieves the form that a line or shape control is on. (Inherited from Shape.)
Public method Focus Sets input focus to a line or shape control. (Inherited from Shape.)
Public method GetContainerControl Returns the next ContainerControl up in a line or shape control's chain of parent controls. (Inherited from Shape.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected method GetService Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Hide Conceals a line or shape control from the user. (Inherited from Shape.)
Public method HitTest Determines whether a shape control is located at the specified point on the screen. (Inherited from SimpleShape.)
Public method InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method Invalidate Invalidates a specific region of a line or shape control and causes a paint message to be sent to the control. (Inherited from Shape.)
Protected method MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Protected method OnBackColorChanged Raises the BackColorChanged event. (Inherited from SimpleShape.)
Protected method OnBackgroundImageChanged Raises the BackgroundImageChanged event. (Inherited from SimpleShape.)
Protected method OnBackgroundImageLayoutChanged Raises the BackgroundImageLayoutChanged event. (Inherited from SimpleShape.)
Protected method OnClick Raises the Click event. (Inherited from Shape.)
Protected method OnClientSizeChanged Raises the ClientSizeChanged event. (Inherited from SimpleShape.)
Protected method OnContextMenuChanged Raises the ContextMenuChanged event. (Inherited from Shape.)
Protected method OnContextMenuStripChanged Raises the ContextMenuStripChanged event. (Inherited from Shape.)
Protected method OnCursorChanged Raises the CursorChanged event. (Inherited from Shape.)
Protected method OnDoubleClick Raises the DoubleClick event. (Inherited from Shape.)
Protected method OnEnabledChanged Raises the EnabledChanged event. (Inherited from Shape.)
Protected method OnEnter Raises the Enter event. (Inherited from Shape.)
Protected method OnGotFocus Raises the GotFocus event. (Inherited from Shape.)
Protected method OnInvalidated Raises the Invalidated event. (Inherited from Shape.)
Protected method OnKeyDown Raises the KeyDown event. (Inherited from Shape.)
Protected method OnKeyPress Raises the KeyPress event. (Inherited from Shape.)
Protected method OnKeyUp Raises the KeyUp event. (Inherited from Shape.)
Protected method OnLeave Raises the Leave event. (Inherited from Shape.)
Protected method OnLocationChanged Raises the LocationChanged event. (Inherited from SimpleShape.)
Protected method OnLostFocus Raises the LostFocus event. (Inherited from Shape.)
Protected method OnMouseClick Raises the MouseClick event. (Inherited from Shape.)
Protected method OnMouseDoubleClick Raises the MouseDoubleClick event. (Inherited from Shape.)
Protected method OnMouseDown Raises the MouseDown event. (Inherited from Shape.)
Protected method OnMouseEnter Raises the MouseEnter event. (Inherited from Shape.)
Protected method OnMouseHover Raises the MouseHover event. (Inherited from Shape.)
Protected method OnMouseLeave Raises the MouseLeave event. (Inherited from Shape.)
Protected method OnMouseMove Raises the MouseMove event. (Inherited from Shape.)
Protected method OnMouseUp Raises the MouseUp event. (Inherited from Shape.)
Protected method OnMouseWheel Raises the MouseWheel event. (Inherited from Shape.)
Protected method OnMove Raises the Move event. (Inherited from Shape.)
Protected method OnPaint Raises the Paint event. (Inherited from SimpleShape.)
Protected method OnParentChanged Raises the ParentChanged event. (Inherited from Shape.)
Protected method OnPreviewKeyDown Raises the PreviewKeyDown event. (Inherited from Shape.)
Protected method OnQueryAccessibilityHelp Raises the QueryAccessibilityHelp event. (Inherited from Shape.)
Protected method OnRegionChanged Raises the RegionChanged event. (Inherited from Shape.)
Protected method OnResize Raises the Resize event. (Inherited from SimpleShape.)
Protected method OnSizeChanged Raises the SizeChanged event. (Inherited from SimpleShape.)
Protected method OnVisibleChanged Raises the VisibleChanged event. (Inherited from Shape.)
Public method PointToClient Computes the location of the specified screen point into client coordinates. (Inherited from Shape.)
Public method PointToScreen Computes the location of the specified client point into screen coordinates. (Inherited from Shape.)
Public method RectangleToClient Computes the size and location of the specified screen rectangle in client coordinates. (Inherited from Shape.)
Public method RectangleToScreen Computes the size and location of the specified client rectangle in screen coordinates. (Inherited from Shape.)
Public method Refresh Forces a control to invalidate its client area and immediately redraw itself and any child controls. (Inherited from Shape.)
Public method ResumePaint Resumes usual painting logic, optionally forcing an immediate layout of pending paint requests. (Inherited from Shape.)
Public method Scale Scales the shape by the specified scaling factor. (Inherited from SimpleShape.)
Public method Select Enables a control. (Inherited from Shape.)
Public method SendToBack Sends a line or shape control to the back of the z-order. (Inherited from Shape.)
Public method SetBounds Sets the bounds of the shape to the specified location and size. (Inherited from SimpleShape.)
Public method Show Displays a shape to the user. (Inherited from Shape.)
Public method SuspendPaint Suspends the painting logic for a shape. (Inherited from Shape.)
Public method ToString Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)
Public method Update Causes the control to redraw the invalidated regions within its client area. (Inherited from Shape.)

Top

Events

  Name Description
Public event BackColorChanged Occurs when the BackColor property of the shape is changed. (Inherited from SimpleShape.)
Public event BackgroundImageChanged Occurs when the BackgroundImage property of a shape is changed. (Inherited from SimpleShape.)
Public event BackgroundImageLayoutChanged Occurs when the BackgroundImageLayout property of a shape is changed. (Inherited from SimpleShape.)
Public event ChangeUICues Occurs when the focus or keyboard user interface (UI) cues change. (Inherited from Shape.)
Public event Click Occurs when the shape is clicked. (Inherited from Shape.)
Public event ClientSizeChanged Occurs when the ClientSize property of a shape is changed. (Inherited from SimpleShape.)
Public event ContextMenuChanged Occurs when the value of the ContextMenu property changes. (Inherited from Shape.)
Public event ContextMenuStripChanged Occurs when the value of the ContextMenuStrip property changes. (Inherited from Shape.)
Public event CursorChanged Occurs when the value of the Cursor property changes. (Inherited from Shape.)
Public event Disposed Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Public event DoubleClick Occurs when the shape is double-clicked. (Inherited from Shape.)
Public event EnabledChanged Occurs when the Enabled property value has changed. (Inherited from Shape.)
Public event Enter Occurs when the shape is entered. (Inherited from Shape.)
Public event GotFocus Occurs when the shape receives focus. (Inherited from Shape.)
Public event Invalidated Occurs when a shape's display requires redrawing. (Inherited from Shape.)
Public event KeyDown Occurs when a key is pressed and the shape has focus. (Inherited from Shape.)
Public event KeyPress Occurs when a key is pressed and the shape has focus. (Inherited from Shape.)
Public event KeyUp Occurs when a key is released and the shape has focus. (Inherited from Shape.)
Public event Leave Occurs when the input focus leaves the shape. (Inherited from Shape.)
Public event LocationChanged Occurs when the Location property of a shape is changed. (Inherited from SimpleShape.)
Public event LostFocus Occurs when the shape loses focus. (Inherited from Shape.)
Public event MouseClick Occurs when the shape is clicked by the mouse. (Inherited from Shape.)
Public event MouseDoubleClick Occurs when the shape is double-clicked by the mouse. (Inherited from Shape.)
Public event MouseDown Occurs when the mouse pointer is over the shape and a mouse button is pressed. (Inherited from Shape.)
Public event MouseEnter Occurs when the mouse pointer enters the shape. (Inherited from Shape.)
Public event MouseHover Occurs when the mouse pointer rests on the shape. (Inherited from Shape.)
Public event MouseLeave Occurs when the mouse pointer leaves the shape. (Inherited from Shape.)
Public event MouseMove Occurs when the mouse pointer is moved over the shape. (Inherited from Shape.)
Public event MouseUp Occurs when the mouse pointer is over the shape and a mouse button is released. (Inherited from Shape.)
Public event MouseWheel Occurs when the mouse wheel moves and the shape has focus. (Inherited from Shape.)
Public event Move Occurs when the shape is moved. (Inherited from Shape.)
Public event Paint Occurs when the shape is redrawn. (Inherited from Shape.)
Public event ParentChanged Occurs when the Parent property value changes. (Inherited from Shape.)
Public event PreviewKeyDown Occurs before the KeyDown event when a key is pressed and focus is on the shape. (Inherited from Shape.)
Public event QueryAccessibilityHelp Occurs when an AccessibleObject is providing Help to accessibility applications. (Inherited from Shape.)
Public event RegionChanged Occurs when the value of the Region property changes. (Inherited from Shape.)
Public event Resize Occurs when the size of a shape is changed. (Inherited from SimpleShape.)
Public event SizeChanged Occurs when the Size property of a shape is changed. (Inherited from SimpleShape.)
Public event VisibleChanged Occurs when the Visible property value changes. (Inherited from Shape.)

Top

Remarks

The OvalShape control enables you to draw circles and ovals on a form or container at design time or run time.

When you add a Line or Shape control to a form or container, an invisible ShapeContainer object is created. The ShapeContainer acts as a drawing surface for the shapes within each container control. Each ShapeContainer has a corresponding ShapeCollection that enables you to iterate through the Line and Shape controls that are contained in the ShapeContainer.

When you create an OvalShape control at run time, you must also create a ShapeContainer and set the Parent property of the OvalShape to the ShapeContainer.

Examples

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

Private Sub DrawCircle()
    Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
    Dim oval1 As New Microsoft.VisualBasic.PowerPacks.OvalShape
    ' Set the form as the parent of the ShapeContainer.
    canvas.Parent = Me
    ' Set the ShapeContainer as the parent of the OvalShape.
    oval1.Parent = canvas
    ' Set the location and size of the circle.
    oval1.Left = 10
    oval1.Top = 10
    oval1.Width = 100
    oval1.Height = 100
End Sub
private void DrawCircle1()
{
    Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas = 
        new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
    Microsoft.VisualBasic.PowerPacks.OvalShape oval1 = 
        new Microsoft.VisualBasic.PowerPacks.OvalShape();
    // Set the form as the parent of the ShapeContainer.
    canvas.Parent = this;
    // Set the ShapeContainer as the parent of the OvalShape.
    oval1.Parent = canvas;
    // Set the location and size of the circle.
    oval1.Left = 10;
    oval1.Top = 10;
    oval1.Width = 100;
    oval1.Height = 100;
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

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)