简体   繁体   中英

All-aero window have controls' colors blended - how to avoid it

I'm looking for a way to paint my custom controls into both the client and non-client area of a dialog. More or less the white area below

在此处输入图片说明

I used DwmExtendFrameIntoClientArea and I managed to get that effect by extending the client area on the entire window with

MARGINS mar = {-1, -1, -1, -1};

DwmExtendFrameIntoClientArea ( hWnd, &mar );

but now every control which I set with a transparent background

SetBkMode(hdc, TRANSPARENT);

have their colors blended with the aero stuff (the same problem you can see here ).

Is there a way for the controls to retain their right color and avoid blending with the background?

It is because the window treated the black colour as the transparency key.

You just need to set another value:

SetWindowLong(hWnd,GWL_EXSTYLE,WS_EX_LAYERED);
// Choose a colour that you will not use in the program, eg RGB(200,201,202)
SetLayeredWindowAttributes(hWnd,RGB(200,201,202),0,LWA_COLORKEY);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM