How would I go about printing colored text with the DrawText function?
Printable View
How would I go about printing colored text with the DrawText function?
You'll have to first set the colour of the text using "SetTextColor".
Example:
PHP Code:SetTextColor(myhdc, RGB(0,255,0));
//DrawText....
Wow you're quick...thanks :)
Now...how can I change the background color of a window?
I think "SetBackColor" will work.
Example:
PS: You can always look up at MSDN for reference on API.PHP Code:SetBackColor(winhdc, RGB(0,0,255));
Thanks, and thanks for pointing MSDN out to me, lol.
D:\Program Files\Microsoft Visual Studio\MyProjects\w32paint\w32paint.cpp(168) : error C2065: 'SetBackColor' : undeclared identifier
Ops, it's "SetBkColor".
This makes the background what I choose only on the local RECT that I define. How can I make it so that it changes the BG for the entire window?
You'll have to first get the handle of your whole window using either "GetDC" or "GetWindowDC".
When creating the window class you can set the background brush.
Code:WNDCLASSEX wnd;
wnd.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
Or:
wc.hbrBackground = CreateSolidBrush(RGB(0, 255, 127));