I've created a static text control using the resource.
I have two questions:
1) Is there a way to apply a color to the static within the resource?
2) How can I change the color after the static control was already created?
Thank you.
I've created a static text control using the resource.
I have two questions:
1) Is there a way to apply a color to the static within the resource?
2) How can I change the color after the static control was already created?
Thank you.
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe
http://www.Bloodware.net - Developing free software for the community.
1) not sure
2) you catch the WM_CTLCOLORSTATIC message
* Can I use the lParam to match the handle to the handle of the static control I wish to paint?Syntax
ParametersCode:WM_CTLCOLORSTATIC WPARAM wParam LPARAM lParam;
wParam
Handle to the device context for the static control window.
lParam
Handle to the static control.
Return Value
If an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control.
* Also, I've tried to color the text itself without the background color but it doesn't work...
Code:case WM_CTLCOLORSTATIC: SetTextColor((HDC)wParam, RGB(0, 255, 0)); return((HBRUSH)0);
Last edited by Devil Panther; 08-08-2005 at 10:54 AM.
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe
http://www.Bloodware.net - Developing free software for the community.
To return a NULL brush, use GetStockObject(NULL_BRUSH).Originally Posted by Devil Panther
You should also call SetBkMode to make the background of the text (not the static control) transparent.
Code:case WM_CTLCOLORSTATIC: { HDC hdc = (HDC) wParam ; HWND ctrl = (HWND) lParam ; SetBkMode( hdc, TRANSPARENT ); SetTextColor( hdc, RGB(0, 255, 0) ); return (LRESULT)GetStockObject(NULL_BRUSH); }
Something is not working...
The result of the code is black text on a white background
Last edited by Devil Panther; 08-10-2005 at 08:34 AM.
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe
http://www.Bloodware.net - Developing free software for the community.
Hmm, it seemed to work for me when I posted that snippet yesterday.
Mind posting your code?
oops, got the lParam and wParam mixed up
it works fine now, thank you.
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe
http://www.Bloodware.net - Developing free software for the community.