How to change font of Labels in CDialog ?
-
I want to change font of static labels in CDialog, to Bold I think it need be dont in OnCtlColor, by getting font from CDC changing and SelectObject(font) from it. But when I try toget current font as CFont* pOldFont = pDC->SelectObject(&TmpFont); that returns NULL; But label is written by some font ? How to get it? And command to change ? thanks
-
I want to change font of static labels in CDialog, to Bold I think it need be dont in OnCtlColor, by getting font from CDC changing and SelectObject(font) from it. But when I try toget current font as CFont* pOldFont = pDC->SelectObject(&TmpFont); that returns NULL; But label is written by some font ? How to get it? And command to change ? thanks
I'll have to say it may be better to have a owner drawn CStatic control. Try this http://www.codeproject.com/staticctrl/clabel.asp?target=CLabel[^] This is a very good class written by Norm Almond. Um, I think I have suggested this before.. Hope people don't think there is any favouritism here :laugh: Ant.
-
I'll have to say it may be better to have a owner drawn CStatic control. Try this http://www.codeproject.com/staticctrl/clabel.asp?target=CLabel[^] This is a very good class written by Norm Almond. Um, I think I have suggested this before.. Hope people don't think there is any favouritism here :laugh: Ant.
-
I want to change font of static labels in CDialog, to Bold I think it need be dont in OnCtlColor, by getting font from CDC changing and SelectObject(font) from it. But when I try toget current font as CFont* pOldFont = pDC->SelectObject(&TmpFont); that returns NULL; But label is written by some font ? How to get it? And command to change ? thanks
You can simply send a
WM_SETFONT
message. However, the font object is not copied by the control - it uses the object handle you sent. You need to keep the object around at least as long as the control(s) which use it. Stability. What an interesting concept. -- Chris Maunder -
You can simply send a
WM_SETFONT
message. However, the font object is not copied by the control - it uses the object handle you sent. You need to keep the object around at least as long as the control(s) which use it. Stability. What an interesting concept. -- Chris Maunder -
I Mike means 1) Create a CFont object within the dialog (member variable). 2) Use
GetDlgItem()
to get the window of the static 3) UseSetFont()
to set the font of the static object. As long as the CFont item is there for the duration of the dialog it will be there for the duration of the dialogs controls. This solution requires you to do all the work in the dialog. Ant. -
I Mike means 1) Create a CFont object within the dialog (member variable). 2) Use
GetDlgItem()
to get the window of the static 3) UseSetFont()
to set the font of the static object. As long as the CFont item is there for the duration of the dialog it will be there for the duration of the dialogs controls. This solution requires you to do all the work in the dialog. Ant. -
Yea InitDialog is fine:-D Ant.
-
Yea InitDialog is fine:-D Ant.