Compartir a través de


ShapeContainer.Cursor Property

Gets or sets the cursor that is displayed when the mouse pointer is over a ShapeContainer.

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

Syntax

'Declaration
Public Overrides Property Cursor As Cursor
public override Cursor Cursor { get; set; }
public:
virtual property Cursor^ Cursor {
    Cursor^ get () override;
    void set (Cursor^ value) override;
}
abstract Cursor : Cursor with get, set 
override Cursor : Cursor with get, set
override function get Cursor () : Cursor 
override function set Cursor (value : Cursor)

Property Value

Type: System.Windows.Forms.Cursor
A Cursor that represents the cursor to display when the mouse pointer is over the ShapeContainer.

Remarks

Assign a Cursor to the Cursor property of a ShapeContainer to change the cursor that is displayed when the mouse pointer is over the ShapeContainer.

The Cursor property is an ambient property. An ambient property is a property that, if it is not set, is retrieved from the parent control or form. For example, a ShapeContainer will have the same Cursor as its parent Form by default.

Examples

The following example displays a hand cursor when the mouse passes over a ShapeContainer but not when it passes over a RectangleShape that is contained by the ShapeContainer. This code requires that you have a Form with a RectangleShape control on it.

Private Sub Form1_Load() Handles MyBase.Load
    ' Display the hand cursor when mouse is over the ShapeContainer.
    ShapeContainer1.Cursor = Cursors.Hand
    ' Display the default cursor when mouse is over the RectangleShape.
    RectangleShape1.Cursor = Cursors.Default 
End Sub
private void form1_Load(System.Object sender, System.EventArgs e)
{
    // Display the hand cursor when mouse is over the ShapeContainer.
    shapeContainer1.Cursor = Cursors.Hand;
    // Display the default cursor when mouse is over the RectangleShape.
    rectangleShape1.Cursor = Cursors.Default;
}

.NET Framework Security

See Also

Reference

ShapeContainer Class

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)