I'm creating dialog form for MFC class by editing .rc file with form designer. I have Dialog form and label on it.
Can't find how to change label's font.
In proprties window I see:
But there is no font properties. Where they are?
you have to write code for that.
For Example
CFont font;
font.CreateFont(
12, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
_T("Arial")); // lpszFacename
GetDlgItem(IDC_STATIC1)->SetFont(&font);
MSDN Link
Example
It takes the font of the dialog by default.
If you change the font of the dialog (by changing the properties of the dialog) everything will appear with the same font.
If you want to change only the font of the label you have to proceed with the arcaic way Himanshu told you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With