Click to See Complete Forum and Search --> : Quick TabControl fix - urgent :)


Some12k
April 22nd, 2005, 04:38 PM
Hello everyone :)

I`m testing the tab control for a new application i will be soon building.
However I have a small problem.

I have created a tab control with 4 tabs. I also created 4 dialog resources with no border, caption etc which will appear on the tab control, one for each tab. All of them are children of the tab control.

So when the user clicks the tab, it displays the right dialog. However on Windows XP, when the dialog appears on the tab control, there is that COLOR_3DFACE color surrounding it, as it should be normally.
So I set a NULL brush to the window class that creates those dialogs and now its OK.

However the problem is, some controls like radio buttons and check boxes still have that COLOR_3DFACE (or is it COLOR_BTNFACE) color surrounding them which makes them look ugly. Is there any way to remove it?

I tried returning a null brush in WM_CTLCOLORSTATIC but then the background becomes black :(
I tried everything and i`m desperately looking for help :(

Check the attached pic to see what I mean.

Does anyone know any solution for this??
I also tried using Property Sheets and they work fine but they are really messy (how windows does this? Don`t property sheets use the tab control too? at least spy++ says so)

Thanks

Some12k
April 23rd, 2005, 09:34 AM
noone knows? :(

plz anyone, i`m stuck here

kkez
April 23rd, 2005, 04:26 PM
Check out this article on codeproject -> http://www.codeproject.com/wtl/ThemedDialog.asp

Anyway, my solution of the three suggested by the article is EnableThemeDialogTexture. Of course you will need to link dynamically to uxtheme.dll (you can't link statically to the dll, e.g. including the library) because if you do that your program won't run on older versions of windows.

You need something like:
typedef HRESULT (WINAPI* PFNENABLETHEMEDIALOGTEXTURE)(HWND, DWORD);

PFNENABLETHEMEDIALOGTEXTURE pEnableThemeDialogTexture;

void LoadUxthemeFunction()
{
HMODULE hDll = LoadLibrary("uxtheme.dll");
if (hDll)
{
pEnableThemeDialogTexture = (PFNENABLETHEMEDIALOGTEXTURE)GetProcAddress(hDll, "EnableThemeDialogTexture");
if (pEnableThemeDialogTexture)
//loaded
else
//not loaded, something went wrong...
}
}

Some12k
April 26th, 2005, 07:22 PM
Thanks that worked :thumb: