Font color in Dialogs
-
Hi !! I'm programming in MFC. I want a CStatic label control to have font color at red. I don't know how to do it, because I'm using this code: CFont* my_font = new CFont; my_font->CreateFont(here all the parameters that I need...); but I can't see anything for the color... What can I do ?? I think that I've to do something with CDC or something... but please, if you could show an example... Thanks in advance !! ;)
Written by: Rafael Fernández López.
-
Hi !! I'm programming in MFC. I want a CStatic label control to have font color at red. I don't know how to do it, because I'm using this code: CFont* my_font = new CFont; my_font->CreateFont(here all the parameters that I need...); but I can't see anything for the color... What can I do ?? I think that I've to do something with CDC or something... but please, if you could show an example... Thanks in advance !! ;)
Written by: Rafael Fernández López.
-
Hi !! I'm programming in MFC. I want a CStatic label control to have font color at red. I don't know how to do it, because I'm using this code: CFont* my_font = new CFont; my_font->CreateFont(here all the parameters that I need...); but I can't see anything for the color... What can I do ?? I think that I've to do something with CDC or something... but please, if you could show an example... Thanks in advance !! ;)
Written by: Rafael Fernández López.
Rafael Fernández López wrote: but I can't see anything for the color... Thats because the control's font has nothing to do with the colour being displayed. One method that I use is to implement the WM_CTLCOLOR message handler, and set the draw colour (SetTextColor()) for all or individual static control. Or you can use a derived label class like this: CLabel[^].
I Dream of Absolute Zero
-
Yes you have to use CPen pen(..) and then pDC->SelectObject(pen); don't forget to free resorces DeleteObject(pen) because after some time our application my behave in funy way :) Pain is a weakness living the body
CPen is for line drawing. You need to use
CDC::SetTextColor(COLORREF)
to choose what colour the text gets drawn in. Roger Allen - Sonork 100.10016 Strong Sad: I am sad I am flying Who is your favorite Strong?