Поделиться через


Shape Class

Implements the basic functionality common to line and shape controls.

Inheritance Hierarchy

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

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

Syntax

'Declaration
Public MustInherit Class Shape _
    Inherits Component
public abstract class Shape : Component
public ref class Shape abstract : public Component
[<AbstractClass>]
type Shape =  
    class
        inherit Component
    end
public abstract class Shape extends Component

The Shape type exposes the following members.

Constructors

  Name Description
Protected method Shape() Initializes a new instance of the Shape class.
Protected method Shape(ShapeContainer) Initializes a new instance of the Shape class.

Top

Properties

  Name Description
Public property AccessibilityObject Gets the AccessibleObject that is assigned to the control.
Public property AccessibleDefaultActionDescription Gets or sets the default action description of the control for use by accessibility client applications.
Public property AccessibleDescription Gets or sets the description of the control that is used by accessibility client applications.
Public property AccessibleName Gets or sets the name of the control that is used by accessibility client applications.
Public property AccessibleRole Gets or sets the accessible role of the control.
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.
Public property BorderColor Gets or sets the color of the border of a shape or line control.
Public property BorderStyle Gets or sets the border style for a shape or line control.
Public property BorderWidth Gets or sets the width of a line or shape control's border.
Public property CanFocus Gets a value indicating whether a line or shape control can receive focus.
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.
Public property Container Gets the IContainer that contains the Component.
Public property ContainsFocus Gets a value indicating whether a line or shape control currently has the input focus.
Public property ContextMenu Gets or sets the shortcut menu associated with a line or shape control.
Public property ContextMenuStrip Gets or sets the ContextMenuStrip associated with a line or shape control.
Public property Created Gets a value indicating whether a line or shape control has been created.
Public property Cursor Gets or sets the cursor that is displayed when the mouse pointer is resting on a line or shape control.
Public propertyStatic member DefaultBorderColor Gets the default border color for a line or shape control.
Protected property DesignMode Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Public property Disposing Gets a value indicating whether the base Shape class is disposing.
Public property Enabled Gets or sets a value indicating whether a line or shape control can respond to user interaction.
Protected property Events Gets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public property Focused Gets a value indicating whether a line or shape control currently has the input focus.
Public property IsAccessible Gets or sets a value indicating whether a line or shape control is available to accessibility applications.
Public property IsDisposed Gets a value indicating whether a line or shape control has been disposed of.
Public propertyStatic member ModifierKeys Gets a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.
Public propertyStatic member MouseButtons Gets a value indicating which of the mouse buttons is in a pressed state.
Public propertyStatic member MousePosition Gets the position of the pointer in screen coordinates.
Public property Name Gets or sets the name of a line or shape control.
Public property Parent Gets or sets the parent container of a line or shape control.
Public property Region Gets or sets the window region associated with a line or shape control.
Public property SelectionColor Gets or sets the selection color of a shape.
Public property Site Gets or sets the ISite of the Component. (Inherited from Component.)
Public property Tag Gets or sets the object that contains data about a line or shape control.
Public property UseWaitCursor Gets or sets a value indicating whether to use the wait cursor for the current line or shape control.
Public property Visible Gets or sets a value indicating whether a line or shape control is displayed.

Top

Methods

  Name Description
Public method BringToFront Brings a line or shape control to the front of the z-order.
Protected method CreateAccessibilityInstance Creates a new accessibility object for a line or shape control.
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. (Overrides Component.Dispose(Boolean).)
Public method DrawToBitmap Supports rendering to the specified bitmap.
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.
Public method Focus Sets input focus to a line or shape control.
Public method GetContainerControl Returns the next ContainerControl up in a line or shape control's chain of parent controls.
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.
Public method HitTest Gets information about a line or shape control at the specified position on the screen.
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.
Public methodStatic member IsKeyLocked Determines whether the CAPS LOCK, NUM LOCK, or SCROLL LOCK key is in effect.
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 OnClick Raises the Click event.
Protected method OnContextMenuChanged Raises the ContextMenuChanged event.
Protected method OnContextMenuStripChanged Raises the ContextMenuStripChanged event.
Protected method OnCursorChanged Raises the CursorChanged event.
Protected method OnDoubleClick Raises the DoubleClick event.
Protected method OnEnabledChanged Raises the EnabledChanged event.
Protected method OnEnter Raises the Enter event.
Protected method OnGotFocus Raises the GotFocus event.
Protected method OnInvalidated Raises the Invalidated event.
Protected method OnKeyDown Raises the KeyDown event.
Protected method OnKeyPress Raises the KeyPress event.
Protected method OnKeyUp Raises the KeyUp event.
Protected method OnLeave Raises the Leave event.
Protected method OnLostFocus Raises the LostFocus event.
Protected method OnMouseClick Raises the MouseClick event.
Protected method OnMouseDoubleClick Raises the MouseDoubleClick event.
Protected method OnMouseDown Raises the MouseDown event.
Protected method OnMouseEnter Raises the MouseEnter event.
Protected method OnMouseHover Raises the MouseHover event.
Protected method OnMouseLeave Raises the MouseLeave event.
Protected method OnMouseMove Raises the MouseMove event.
Protected method OnMouseUp Raises the MouseUp event.
Protected method OnMouseWheel Raises the MouseWheel event.
Protected method OnMove Raises the Move event.
Protected method OnPaint Raises the Paint event.
Protected method OnParentChanged Raises the ParentChanged event.
Protected method OnPreviewKeyDown Raises the PreviewKeyDown event.
Protected method OnQueryAccessibilityHelp Raises the QueryAccessibilityHelp event.
Protected method OnRegionChanged Raises the RegionChanged event.
Protected method OnVisibleChanged Raises the VisibleChanged event.
Public method PointToClient Computes the location of the specified screen point into client coordinates.
Public method PointToScreen Computes the location of the specified client point into screen coordinates.
Public method RectangleToClient Computes the size and location of the specified screen rectangle in client coordinates.
Public method RectangleToScreen Computes the size and location of the specified client rectangle in screen coordinates.
Public method Refresh Forces a control to invalidate its client area and immediately redraw itself and any child controls.
Public method ResumePaint Resumes usual painting logic, optionally forcing an immediate layout of pending paint requests.
Public method Scale Scales a shape by the specified scaling factor.
Public method Select Enables a control.
Public method SendToBack Sends a line or shape control to the back of the z-order.
Public method Show Displays a shape to the user.
Public method SuspendPaint Suspends the painting logic for a 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.

Top

Events

  Name Description
Public event ChangeUICues Occurs when the focus or keyboard user interface (UI) cues change.
Public event Click Occurs when the shape is clicked.
Public event ContextMenuChanged Occurs when the value of the ContextMenu property changes.
Public event ContextMenuStripChanged Occurs when the value of the ContextMenuStrip property changes.
Public event CursorChanged Occurs when the value of the Cursor property changes.
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.
Public event EnabledChanged Occurs when the Enabled property value has changed.
Public event Enter Occurs when the shape is entered.
Public event GotFocus Occurs when the shape receives focus.
Public event Invalidated Occurs when a shape's display requires redrawing.
Public event KeyDown Occurs when a key is pressed and the shape has focus.
Public event KeyPress Occurs when a key is pressed and the shape has focus.
Public event KeyUp Occurs when a key is released and the shape has focus.
Public event Leave Occurs when the input focus leaves the shape.
Public event LostFocus Occurs when the shape loses focus.
Public event MouseClick Occurs when the shape is clicked by the mouse.
Public event MouseDoubleClick Occurs when the shape is double-clicked by the mouse.
Public event MouseDown Occurs when the mouse pointer is over the shape and a mouse button is pressed.
Public event MouseEnter Occurs when the mouse pointer enters the shape.
Public event MouseHover Occurs when the mouse pointer rests on the shape.
Public event MouseLeave Occurs when the mouse pointer leaves the shape.
Public event MouseMove Occurs when the mouse pointer is moved over the shape.
Public event MouseUp Occurs when the mouse pointer is over the shape and a mouse button is released.
Public event MouseWheel Occurs when the mouse wheel moves and the shape has focus.
Public event Move Occurs when the shape is moved.
Public event Paint Occurs when the shape is redrawn.
Public event ParentChanged Occurs when the Parent property value changes.
Public event PreviewKeyDown Occurs before the KeyDown event when a key is pressed and focus is on the shape.
Public event QueryAccessibilityHelp Occurs when an AccessibleObject is providing Help to accessibility applications.
Public event RegionChanged Occurs when the value of the Region property changes.
Public event VisibleChanged Occurs when the Visible property value changes.

Top

Remarks

You do not typically inherit from Shape. To create your own line or shape class, inherit from the LineShape or the SimpleShape class.

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

LineShape

OvalShape

RectangleShape

SimpleShape

Other Resources

How to: Draw Lines with the LineShape Control (Visual Studio)

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)

Introduction to the Line and Shape Controls (Visual Studio)