tags:

views:

21

answers:

1

Group boxes don't render properly if the parent window has the WS_CLIPCHILDREN style set. My current workaround is to simply remove the flag from the parent. However this results in extreme flickering when resizing the window.

Is there a better workaround possible?

Update

The Dr Dobbs article Resizable Dialogs Revisited address exactly the same problem that I am experiencing. The solution offered reduces flashing, but doesn't eliminate it. I'll be using this code. However if better solutions would be possible, then feel free to post them!

+1  A: 

Don't use group boxes.

Group boxes only make sense in layouts where controls are going to be overlapped - which styles like WS_CLIBSIBLINGS | WS_CLIPCHILDREN only make sense in layouts where there is NO control overlap.

The only way to get overlapping controls to work flicker free would be to actually make the grouped controls children of the group box. Then they'd be clipped out of its area when it paints.

Microsoft added a style to Windows 2000 to fix this issue: WS_EX_COMPOSITED that forces a bottom to top paint order on child controls and paints everything in the context of the parent windows WM_PAINT message - but they promptly broke that style with Windows Vista and 7 - WS_EX_COMPOSITED only works now if aero glass is disabled. Ew.

Chris Becke
I remember vaguely that making the controls children of the groupbox results in really weird behavior. I'll give this another try tonight.
StackedCrooked