|
-
May 5th, 1999, 12:07 AM
#1
changing the color of text in MFC
I am trying to change the color of the text in a text box in an MFC application, can anyone help me. Or if anyone knows a better type of control to use which would work in MFC that would be great too. Thanks
-
May 5th, 1999, 01:16 AM
#2
Re: changing the color of text in MFC
You have to overide OnCtlColor()
as given below with the WM_CTLCOLOR inside
BEGIN_MESSAGE_MAP
HBRUSH CMydialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor == CTLCOLOR_STATIC)
hbr = CreateSolidBrush(RGB(O,O,O);
pDC->SetBkColor(RGB(O,O,O));
pDC->SetTextColor(RGB(255,255,255
));
// TODO: Return a different brush if the default is not desired
return hbr;
}
the above code will have a black background
and white text color for all the static text
you have created.
if you have still doubt mail at the same place
kals
Thanks for reading the mail.
Expecting a postivie Reply
kals
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|