views:

380

answers:

3

I have an ATL application with a dialog containing a TAB control. The App uses a common controls manifest.

Under XP with visual styles, the tab control background is a different color than the dialog and the controls (mostly checkboxes), so it looks quite ugly.

Screenshot

How can I fix that?

A: 

The check boxes will post WM_CTLCOLORBTN notifications to their parent. If, for the checkbox control IDs, the parent window's message handler returns the result of

GetStockObject(HOLLOW_BRUSH)

then the check boxes should be drawn with a transparent background, which should give you the look you want.

DavidK
+1  A: 

Here you could find answer to your question.

Kirill V. Lyadvinsky
Not perfect but does its job - thanks!
peterchen
+2  A: 

There is - apparently - one thing to do to get tab control pages colored correctly using XP visual styles.

In the WM_INITDIALOG handler for each page, call the uxtheme API EnableThemeDialogTexture

With the ETDT_ENABLETAB flag this automatically changes the background color of the dialog and all its child controls to paint appropriately on a tab.

The dialog pages do not need any kind of transparent flag, or indeed any style bit set differently from previously. If you have overridden WM_ERASEBKGND or WM_CTLCOLORDLG in your pages DialogProc you will need to revert to default handling (return FALSE).

Chris Becke