Go Diagram is too slow

I have about 400 nodes on the diagram.
And I have a timer control that changes color of all the nodes (depends of the status) each 0.5 sec.
And it goes really really slow! One cycle takes about 3 sec. ( and user expect 0.5 sec)
But if I minimize the form with a diagram, it takes less then a 0.1 sec to do it (30 times faster).
Is it anything I can do to remove that delay?
Thank you

How do you create each node? what is the object you are coloring? How big are the nodes?







I use the same logic as ColoredNode from Demo1 example (version3.0.3). The node object inherits from GoGeneralNode. Sizes are 35x35 and 25x80. If user zoom in or make the form bigger, the execution is slowing down.

If I run the code below, it creates 400 GoBasicNodes with a rectangle GoFigure. The stopwatch times changing the color 5 times (with a DoEvents so the screen is painted) and for me, the timing is less than 2/10 second for 5 full screenpaints.



If I change it to a Circle, it takes .27 of a second.



and my tests were run on a 3 year old laptop.



Both these timings are under your 1/2 second window. I don’t know why it’s taking 3 seconds for you. Are you using gradients?



for (int i = 0; i < 20; i++) {

for (int j = 0; j < 20; j++) {

GoBasicNode n = new GoBasicNode(GoFigure.Rectangle);

n.Shape.Size = new SizeF(35,35);

n.Location = new PointF(i40+50, j40+50);

doc.Add(n);

}

}



Application.DoEvents();

System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();

watch.Start();

foreach (GoObject o in doc) {

GoBasicNode n = o as GoBasicNode;

if (n != null) n.Shape.Brush = Brushes.Beige;

}

Application.DoEvents();

foreach (GoObject o in doc) {

GoBasicNode n = o as GoBasicNode;

if (n != null) n.Shape.Brush = Brushes.Blue;

}

Application.DoEvents();

foreach (GoObject o in doc) {

GoBasicNode n = o as GoBasicNode;

if (n != null) n.Shape.Brush = Brushes.Red;

}

Application.DoEvents();

foreach (GoObject o in doc) {

GoBasicNode n = o as GoBasicNode;

if (n != null) n.Shape.Brush = Brushes.Yellow;

}

Application.DoEvents();

foreach (GoObject o in doc) {

GoBasicNode n = o as GoBasicNode;

if (n != null) n.Shape.Brush = Brushes.Chocolate;

}

Application.DoEvents();





watch.Stop();

toolStripStatusLabel1.Text = watch.Elapsed.ToString();

OK, ColoredNode is a little more complex than my sample above, and it does use gradient fill.



Can you upload a screenshot? (use the post reply button at the top of the page to get the full editor)

Even with gradients and zoomed in, I get to .59/second for 400 nodes drawn 5 times, so that’s still a little over a 1/10 second for one of your refreshes.



Can you post the code that you use to actually change the color of the nodes? Are you sure when the window is minimized that you go through a full cycle of computing and setting the colors on each node?