I have written a program to draw Spirograph and related patterns, the plotting is fairly simplistic and just calculates a series of points and uses PlotLine to draw between successive on the fly. This works well for simple patterns, but complex ones can take up to a second to draw. The problem is with resizing the window with the mouse with complex patterns. As far as I can see resizing the window sends multiple EVT_SIZE events which clash with the program attempting to recalculate the pattern at the new size. Is there any way to delay the panel from redrawing until the user has finished the resize (presumably lets go of the mouse button)? Or am I taking too simplistic an approach and would drawing into a buffer be a better approach?
Any pointers to how to go about this would be greatly appreciated.
Have you explored panel.Freeze() and panel.Thaw()? Just a thought.
SetAutoLayout (self , autoLayout )
Things like this are typically done with a timer. In the EVT_SIZE event you can start (or restart) a timer with a timeout of N milliseconds. When there has been N milliseconds without a new size event then the timer event handler is called and you can then stop the timer and call whatever code recalculates the window content, draw that content to a bitmap, and then call
Refresh so there will be a new paint event. In the paint event you just draw the current version of that bitmap.