/// <summary> /// Gets the cursor corresponding to the given mouse position. /// </summary> /// <remarks> /// Changes the cursor to Cursors.No before the first mouse click if the source shape is not valid. /// </remarks> 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)); }
/// <summary> /// Gets the cursor corresponding to the given mouse position. /// </summary> /// <remarks> /// Changes the cursor to Cursors.No before the first mouse click if the source shape is not valid. /// </remarks> 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); }