Possible Duplicate:
How do I suspend painting for a control and its children?
Winforms Double Buffering
I have a form that draws a bunch of user defined controls (81 of them) each of which contains another ten controls (total 8,100 ish). It all seems to be drawn sequentially (takes ~1 second or so).
I've looked at these two questions, and followed the ier reccomendations (setting this.DoubleBuffered = true
on both the form and the custom control, and SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
on the form, but that did not appear to do anything.
Is there a way to save the paint function of the form, save it in a delegate, swap in a dummy function so that the form does not get redrawn AT ALL, and then putting the real function back and triggering it.
I assume there is a more standard way of doing this, but I was unable to find it (it is not SuspendLayout
/ResumeLayout
those just deal with layout logic).
How can I do this?