I would like to make my static control have transparent background. And how can I make the same thing with edit control?
This doesn't seem to work:
Code:hdc=GetDC(staticcontrolhwnd); SetBkMode(hdc,TRANSPARENT); ReleaseDC(staticcontrolhwnd,hdc);
I would like to make my static control have transparent background. And how can I make the same thing with edit control?
This doesn't seem to work:
Code:hdc=GetDC(staticcontrolhwnd); SetBkMode(hdc,TRANSPARENT); ReleaseDC(staticcontrolhwnd,hdc);
Last edited by maxorator; 11-02-2005 at 08:17 AM.
MSDN:
The SetBkMode function sets the background mix mode of the specified device context. The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.
This functin doesn't pertain to true "window" transparency as you imagine.
And here's how: Making any application transparent in Windows 2000/XP
You got me wrong. I want to use it with a static control, so the text will be visible and the background of the static control is transparent.
Solved, I had the wrong hdc...
I used it in a WM_CTLCOLORSTATIC:
I used lParam as the hdc, but actually wParam was the hdc, lParam was the handle:Code:case WM_CTLCOLORSTATIC: SetBkMode((HDC)lParam,TRANSPARENT); return (LRESULT)CreateSolidBrush(RGB(0, 74, 239));
Thanks for your help.Code:case WM_CTLCOLORSTATIC: SetBkMode((HDC)wParam,TRANSPARENT); return (LRESULT)CreateSolidBrush(RGB(0, 74, 239));
Ah, ok. Glad you got it all sorted out then.