Hello,
I'm still using FC.NET 4.0.3
Next to links between nodes I also want to be able to draw lines, no free form lines. Just drag from one point of the chart to another and get a line between them.
It almost works now, but I have to keep setting the origin en destination to DummyNode (and reset the controlpoints) so that they don't connect to the nodes when I drop the enpoints on top of a node.
Now the only problem remaining is that when I create a new arrow (that is a "line") and drag the endpoint over a node, the endpoint jumps to the border of that node.
This behaviour was also present with the startpoint (so the first endpoint) but I've been able to disable that behaviour with:
Private Sub OnArrowCreated(ByVal sender As System.Object, ByVal e As MindFusion.Diagramming.WinForms.ArrowEventArgs) Handles mMainFlowChart.ArrowCreated
e.Arrow.Tag = Me.mBusiness.DrawingMode
If e.Arrow.Origin.Equals(e.Arrow.Destination) AndAlso _
Me.mBusiness.DrawingMode = DrawingModes.Normal Then
Me.mMainFlowChart.DeleteObject(e.Arrow)
Else
If Me.mBusiness.DrawingMode = DrawingModes.Line Then
' When line, we don't want anything connecting anything:
Dim mStartPoint As PointF = e.Arrow.ControlPoints(0)
Dim mEndPoint As PointF = e.Arrow.ControlPoints(e.Arrow.ControlPoints.Count - 1)
e.Arrow.Origin = New DummyNode(Me.mMainFlowChart)
e.Arrow.ControlPoints(0) = mStartPoint
e.Arrow.Destination = New DummyNode(Me.mMainFlowChart)
e.Arrow.ControlPoints(e.Arrow.ControlPoints.Count - 1) = mEndPoint
' Also, make sure the crossings are never drawn
e.Arrow.DrawCrossings = False
e.Arrow.UpdateFromPoints()
End If
Me.mBusiness.HandleCreatedArrow(e.Arrow)
Me.SetDirty()
End If
End Sub
I do the same kind of stuf in ArrowModified.
SnapToAnchor is in "OnCreate" (I wish I wish there was a "None" with that one) and the border snapping is turned off when I'm in the "line drawing mode".
However, isn't there a more convenient way to just draw a line that is not related to an arrow?
I'm thinking about inheriting my own arrow class or even start from a lower object... but that's probably to much work in the time span I have.
Thanks allready!