共用方式為


ShapeElement.GetCursor 方法

取得當滑鼠位於形狀上方時所顯示的指標。

命名空間:  Microsoft.VisualStudio.Modeling.Diagrams
組件:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0 (在 Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0.dll 中)

語法

'宣告
Public Overridable Function GetCursor ( _
    currentCursor As Cursor, _
    diagramClientView As DiagramClientView, _
    mousePosition As PointD _
) As Cursor
public virtual Cursor GetCursor(
    Cursor currentCursor,
    DiagramClientView diagramClientView,
    PointD mousePosition
)

參數

傳回值

型別:System.Windows.Forms.Cursor
當滑鼠位於形狀上方時所顯示的指標。

範例

public override global::System.Windows.Forms.Cursor GetCursor(global::System.Windows.Forms.Cursor currentCursor, DslDiagrams::DiagramClientView diagramClientView, DslDiagrams::PointD mousePosition)
{
if (this.MouseDownHitShape == null && currentCursor != global::System.Windows.Forms.Cursors.No)
{
DslDiagrams::DiagramHitTestInfo hitTestInfo = new DslDiagrams::DiagramHitTestInfo(diagramClientView);
this.Diagram.DoHitTest(mousePosition, hitTestInfo);
DslDiagrams::ShapeElement shape = hitTestInfo.HitDiagramItem.Shape;

DslDiagrams::ConnectionType connectionType = GetConnectionTypes(shape, null)[0];
string warningString = string.Empty;
if (!connectionType.CanCreateConnection(shape, null, ref warningString))
{
return global::System.Windows.Forms.Cursors.No;
}
}
return base.GetCursor(currentCursor, diagramClientView, mousePosition);
}

.NET Framework 安全性

請參閱

參考

ShapeElement 類別

Microsoft.VisualStudio.Modeling.Diagrams 命名空間