PDA

Click to See Complete Forum and Search --> : Colored Text...


AnT
Jul 8th, 2002, 12:06 AM
How would I go about printing colored text with the DrawText function?

abdul
Jul 8th, 2002, 12:08 AM
You'll have to first set the colour of the text using "SetTextColor".
Example:

SetTextColor(myhdc, RGB(0,255,0));
//DrawText....

AnT
Jul 8th, 2002, 12:09 AM
Wow you're quick...thanks :)

AnT
Jul 8th, 2002, 12:11 AM
Now...how can I change the background color of a window?

abdul
Jul 8th, 2002, 12:17 AM
I think "SetBackColor" will work.
Example:

SetBackColor(winhdc, RGB(0,0,255));


PS: You can always look up at MSDN for reference on API.

AnT
Jul 8th, 2002, 12:20 AM
Thanks, and thanks for pointing MSDN out to me, lol.

AnT
Jul 8th, 2002, 12:21 AM
D:\Program Files\Microsoft Visual Studio\MyProjects\w32paint\w32paint.cpp(168) : error C2065: 'SetBackColor' : undeclared identifier

abdul
Jul 8th, 2002, 12:28 AM
Ops, it's "SetBkColor".

AnT
Jul 8th, 2002, 12:32 AM
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?

abdul
Jul 8th, 2002, 03:01 AM
You'll have to first get the handle of your whole window using either "GetDC" or "GetWindowDC".

CornedBee
Jul 10th, 2002, 07:54 PM
When creating the window class you can set the background brush.

prog_tom
Jul 11th, 2002, 09:46 AM
WNDCLASSEX wnd;

wnd.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);

CornedBee
Jul 13th, 2002, 09:03 PM
Or:
wc.hbrBackground = CreateSolidBrush(RGB(0, 255, 127));