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

public override Cursor Cursor { get; set; }
public:
property Cursor^ Cursor {
    virtual Cursor^ get() override;
    virtual void set(Cursor^ value) override;
}
override Cursor : Cursor with get, set
Public Overrides Property Cursor As 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 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;
}
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

See Also

ShapeContainer 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