Hi gang,

I've been up against this kind of problem for a while and never found a quick way round it but we'll see...

I have a form in a C# project with multiple, nested GroupBox controls and buttons, labels etc within. Certain actions on the form (clicking certain buttons) cause most of the rest of the form to become disabled until the action is completed.

The problem I'm having is that, when disabling or enabling multiple group boxes, you can see each individual control switch from enabled to disabled in turn, meaning that the entire thing takes near a second to finish and looks fairly unprofessional. What I'm looking for is for all of the relevant controls to be enabled in one instant, and then appear disabled in the next.

Effectively I think I'm looking for a SuspendLayout/ResumeLayout function call pair that would prevent a control and its children from painting until I say so such that I could set the Enabled property of the relevant group boxes and only once done allow the controls to repaint themselves.

Has anyone else come across this style of problem and figured a resolution? I've tried hooking WM_PAINT but it doesn't seem to fire when the Enabled property is set. It almost seems like a bug, I would have thought that setting Enabled would invalidate the control and result in it being redrawn in more of a batch form rather than the instant the property is set.