共用方式為


ShapeContainer.Cursor 屬性

取得或設定將滑鼠指標移至 ShapeContainer 上方時顯示的游標。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
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)

屬性值

類型:Cursor
Cursor,表示當滑鼠指標在 ShapeContainer 上方時要顯示的游標。

備註

Cursor 設為 ShapeContainer 的 Cursor 屬性變更時顯示的游標,當滑鼠指標移至 ShapeContainer上方時。

Cursor 屬性是環境屬性。 環境屬性 是屬性,否則,如果未設定,將會從父控制項或表單擷取。 例如,依照預設,ShapeContainer 與其父 Form 有相同的 Cursor。

範例

下列範例顯示手狀游標,當滑鼠經過 ShapeContainer ,但沒有時,由 ShapeContainer包含的它傳遞 RectangleShape 時。 這個範例要求您必須擁有與 RectangleShape 控制項的 Form 至這個。

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 安全性

請參閱

參考

ShapeContainer 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

Line 和 Shape 控制項簡介 (Visual Studio)

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)