TAB control background in ATL App, XP styles

久未见 提交于 2019-12-11 09:28:56

问题


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?


回答1:


Here you could find answer to your question.




回答2:


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).




回答3:


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.



来源:https://stackoverflow.com/questions/776304/tab-control-background-in-atl-app-xp-styles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!