I am creating tab control with child dialog boxes as pages.
I have Visual Styles
enabled via #pragma
comment. I ha
Your tab dialogs are below the tab control in the Z order. This causes crazy overdraw issues on first resizing. After adding the tab dialogs as childs to your main window, call SetWindowPos(tab, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)
to move them to the top of the Z order.
Had this exact issue; took me days to figure it out. I created a simple application in Visual Studio:
InitCommonControlsEx()
WM_PRINTCLIENT
or anything alikeEnableThemeDialogTexture()
in WM_INITDIALOG
of the sub-dialogI went to check it on XP and … it worked perfect and looked beautiful, apart from flickering.
I added WS_CLIPCHILDREN
and suddenly was able to reproduce your screenshots perfectly. I was first thinking this was the cause.
I kept pushing and added WS_COMPOSITED
to prevent flickering, and the tab window suddenly was gone – entirely covered by the tab’s background. Now I realized the Z order was at fault.
Child windows are always created at the bottom of the Z order, i.e. below your tab control. Your code never moves them upwards. The tabs only ever displayed by pure luck/overdraw, producing the artifacts you observe. Fix the Z order and there will be no more artifacts.