求教:用代码在对话框中添加的checkbox控件字体大小怎样改变?谢谢先。

解决方案 »

  1.   

    m_pCheckBox->SetFont(……);CWnd::SetFont
    void SetFont( CFont* pFont, BOOL bRedraw = TRUE );ParameterspFontSpecifies the new font.bRedrawIf TRUE, redraw the CWnd object.ResSets the window’s current font to the specified font. If bRedraw is TRUE, the window will also be redrawn.
      

  2.   

    CFont m_font;
    VERIFY(m_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
       "Arial"));                 // lpszFacenameCFont *pOldFont=m_pCheckBox->SetFont(&m_font);
      

  3.   

    设置控件的字体就可以了。
    SetFont
      

  4.   

    按照 bluebohe(薄荷)的方法,如下代码,没有实现,请问哪里有问题。
    CFont m_font;
    VERIFY(m_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
       "Arial"));                 // lpszFacename   m_pCheck=new CButton();
       m_pCheck->Create(text,BS_AUTOCHECKBOX|WS_TABSTOP|WS_VISIBLE,
       CRect(20,80,100,100),this,1201);
       ((CButton *)GetDlgItem(1201))->SetFont(&m_font,TRUE);
      

  5.   

    同意bluebohe(薄荷)
    创建好字体后,CreateFont()
    就用SetFont()
      

  6.   

    CFont m_font;这个变量我给你加了一个m_,就表示这个变量应该声明成成员变量,而不是局部变量
      

  7.   

    同意楼上就是createfont后再setfont
      

  8.   

    感谢 bluebohe(薄荷) 和各位提供的帮助,马上结帖。