Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Still an Exception after restoring ControlPoints (Read 1534 times)
petry
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Joined: Jan 31st, 2006
Still an Exception after restoring ControlPoints
Apr 4th, 2006 at 7:31am
Print Post  
I store the Nodes, Arrows as FlowRows and ControlPoints as FlowPointRows in a DataSet.

After recreating all nodes, i try to recreate the arrows and there ControlPoints by the following code:

For Each flowRow In GetFlowRows()

' Determine the sourceBox and drainBox of the arrow
' ...

Dim arrow As Arrow = Me.FlowChart.CreateArrow(sourceBox, flowRow.SourceAnchor, drainBox, flowRow.DrainAnchor)
Dim filter As String = String.Format("[Flow] = '{0}'", flowRow.FlowId)
Dim flowPointRows() As dsFmea.FlowPointRow = dsFmea.FlowPoint.Select(filter, "Index")

arrow.Tag = flowRow
arrow.OrgnAnchor = flowRow.SourceAnchor
arrow.DestAnchor = flowRow.DrainAnchor
arrow.Style = ArrowStyle.Cascading
arrow.SegmentCount = flowPointRows.Length - 1

For i As Int32 = arrow.ControlPoints.Count To flowPointRows.Length - 1
    arrow.ControlPoints(i) = New PointF(flowPointRows(i).LocationX, flowPointRows(i).LocationY)
Next

Next

Sometimes the ControlPoints collection size of an arrow is smaller than the count of stored points. Also the assignment of arrow.SegmentCount does not enlarge the collection. So i changed the loop to restore the points as follows:

For i As Int32 = 0 To Math.Min(arrow.ControlPoints.Count, flowPointRows.Length) - 1
    arrow.ControlPoints(i) = New PointF(flowPointRows(i).LocationX, flowPointRows(i).LocationY)
Next

For i As Int32 = arrow.ControlPoints.Count To flowPointRows.Length - 1
    arrow.ControlPoints.Add(New PointF(flowPointRows(i).LocationX, flowPointRows(i).LocationY))
Next

But after the user touched the origin or destination box of such an arrow the FlowChart throws an "Index out of range" Exception.
How can i fix this?

Thank You,
Oliver Petry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Still an Exception after restoring ControlPoin
Reply #1 - Apr 4th, 2006 at 8:54am
Print Post  
Hi,

There was a similar case reported here several weeks ago. Then that happenned because the Arrow.AutoRoute mode had been enabled when setting SegmentCount. When automatic routing is enabled, the control won't let you change the number of arrow segments. So if you use routing, disable it for a while when restoring the control points.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint