This topic has not yet been rated - Rate this topic

ShapeElement.GetCursor Method

Gets the pointer that appears when the mouse is over the shape.

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll)
public virtual Cursor GetCursor(
	Cursor currentCursor,
	DiagramClientView diagramClientView,
	PointD mousePosition
)

Parameters

currentCursor
Type: System.Windows.Forms.Cursor
The pointer to display over the shape.
diagramClientView
Type: Microsoft.VisualStudio.Modeling.Diagrams.DiagramClientView
The client view for the diagram.
mousePosition
Type: Microsoft.VisualStudio.Modeling.Diagrams.PointD
The position of the pointer, relative to the top-left point of the diagram.

Return Value

Type: System.Windows.Forms.Cursor
The pointer that appears when the mouse is over the shape.
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);
}
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ