Background transparency of buttons using Win32 and visual styles

Edit: If anyone has tried this in win32 before, am I going in the right direction using DrawThemeBackground ()?

I recently enabled Visual Styles using the manifest for version 6 of ComCtl32.dll. Win32 Visual Styles Example: Visual Styles

The buttons look great, but I can't figure out how to make the background around the buttons transparent. See example image: http://www.freeimagehosting.net/image.php?2bdeff33ba.jpg

My main window background color is set to dark gray with:

a.hbrBackground = GetStockObject(DKGRAY_BRUSH);

      

Common controls are initialized with:

INITCOMMONCONTROLSEX stylesStruct;
stylesStruct.dwSize = sizeof(stylesStruct);
stylesStruct.dwICC = ICC_STANDARD_CLASSES;
InitCommonControlsEx(&stylesStruct);

      

And I create windows with buttons:

j = CreateWindow(L"BUTTON", L"hello",
    WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 100, 100,
    100, 100, h, 0, hInst, 0);

      

The buttons look great on a white background, but the border becomes visible above anything else. Can I make the border around buttons transparent?

0


a source to share


1 answer


Have you tried WS_EX_TRANSPARENT

?



I think you can install it in the resource editor in Visual Studio if you are using it.

+1


a source







All Articles