ShapeElement.GetCursor 方法

获取当鼠标指针悬停于形状之上时显示的指针。

命名空间:  Microsoft.VisualStudio.Modeling.Diagrams
程序集:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.0(在 Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.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 命名空间