Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static text font parameters change

Tags:

visual-c++

mfc

I'm creating dialog form for MFC class by editing .rc file with form designer. I have Dialog form and label on it.

enter image description here

Can't find how to change label's font.

In proprties window I see:

enter image description here

But there is no font properties. Where they are?

like image 547
vico Avatar asked Feb 06 '23 17:02

vico


2 Answers

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

like image 110
Himanshu Avatar answered Feb 12 '23 07:02

Himanshu


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.

like image 36
28547_user Avatar answered Feb 12 '23 07:02

28547_user