I don’t think I understand how document/view refreshing works in GoDiagram. I am encountering a problem that seems related to the way the document/view refreshes but I have no idea how to even approach fixing it. I wanted to enable the user to create more points in a link by just clicking on an “Add Point” selection in the link context menu. So I added this sub to my link class which is called by my context menu:
Public Sub AddPoint_Command(ByVal sender As Object, ByVal e As EventArgs)
Dim Point, Point2 As PointF
Dim Index, Index2 As Integer
Index = Me.RealLink.GetSegmentNearPoint(Mouse_Click)
Point = Me.RealLink.GetPoint(Index)
Index2 = Index + 1
Point2 = Me.RealLink.GetPoint(Index2)
Me.RealLink.InsertPoint(Index2, New PointF((Point.X + Point2.X) / 2, (Point.Y + Point2.Y) / 2))
And it works great when I step through the code and force the document to refresh by clicking back and forth between the code view and the run-time view. However, if I just try to run this code without stepping through it or by forcing it to refresh, it takes a very long time to create the points. And then, after the user has made about 5 or 6 new points, it errors out because it can’t find the point on the line closest to where the user clicked the mouse button.
So at this point I have no idea what the problem might be. Does anyone have any thoughts on what the problem could be? Just ideas of things to try would be very helpful right now!! Thanks!!
Search for “Insert Point” or “InsertPoint” in the C# samples–several of those links support context menu commands for inserting additional points into the link/stroke.