Fonts and MFC
-
How can I set a Font to a CWnd object with SetFont ?? I try with method GetLogFont, but I don't know how to build a LOGFONT object. Please if you could give me an example... (For Example: Tahoma, size 12).Thank you. :confused:
MaestroProgramador.Com Where every source code is loved like a girl.
-
How can I set a Font to a CWnd object with SetFont ?? I try with method GetLogFont, but I don't know how to build a LOGFONT object. Please if you could give me an example... (For Example: Tahoma, size 12).Thank you. :confused:
MaestroProgramador.Com Where every source code is loved like a girl.
Try this:
CFont tahomaFont; tahomaFont.CreatePointFont(120, "Tahoma"); // 12 pt * 10 YourCWndObject.SetFont(&tahomaFont);
That should work. A really good idea is to store your font objects as member variables of a class so you can clean up after yourself at the destructor phase. Hope this helps
www.kinkycode.com [Glossary Manager] [AfterThought Backup Lite] 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...
-
Try this:
CFont tahomaFont; tahomaFont.CreatePointFont(120, "Tahoma"); // 12 pt * 10 YourCWndObject.SetFont(&tahomaFont);
That should work. A really good idea is to store your font objects as member variables of a class so you can clean up after yourself at the destructor phase. Hope this helps
www.kinkycode.com [Glossary Manager] [AfterThought Backup Lite] 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...
Thank you so much, it was very helfully. It sent me an assert error, but I solved it with:
CFont* my_font = new CFont; my_font->CreatePointFont(120, "Tahoma");
Thank you so much !! :)
MaestroProgramador.Com Where every source code is loved like a girl.