yuzhould

 //得到默认字体
static CFont     m_MyFont;//必须是公共变量
 LOGFONT   stFont;
 ::SystemParametersInfo(SPI_GETICONTITLELOGFONT,
  sizeof(LOGFONT),&stFont,SPIF_SENDWININICHANGE);
 m_MyFont.CreateFontIndirect(&stFont);
 m_pBtnBackMap->SetFont(&m_MyFont);

 

///////改变字体
 m_pBtnBackMap = new CButton();
 m_pBtnBackMap->Create(_T("返回"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(10,10,80,30), this, IDC_BUTTON_BACKMAP);
 static CFont   btnFont;
 btnFont.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("宋体"));                    // lpszFacename

 m_pBtnBackMap->SetFont(&btnFont);

 

//那个font必须是静态的或者成员变量,不然无效。

 

分类:

技术点:

相关文章:

  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2021-07-13
  • 2021-09-25
  • 2022-12-23
猜你喜欢
  • 2021-12-06
  • 2021-12-19
  • 2021-12-29
  • 2021-06-19
  • 2021-12-12
  • 2022-01-02
  • 2021-12-13
相关资源
相似解决方案