1、
  我派生了一个CEdit类,CABEdit,重载OnCreate,在里面用SetFont设置字体为宋  体,但 是如果这个Edit有垂直滚动条的话,我一拖动,里面的文字就有阴影,我是指重叠在一起了?
2、
  我用CreateFont(...."隶书"),却不是隶书字体?
3、
  CFontDialog里怎样预置默认值为粗体,我看
  CFontDialog dlg;
  dlg.lf....什么的没有粗体属性?
4、
  在弹出的CFontDialog对话框里,选择宋体9号,然后我查看dlg.lfHeight却为90?
  那我怎样用在CreateFont的时候呢?
  在CreateFont的时候却是(9,..."宋体")呀。

解决方案 »

  1.   

    有,不然CFontDialog中列举 不出来的。
      

  2.   

    CFont 变量要设置成类的成员变量
      

  3.   

    CreateFont(-16,0, 0,0,400, 0,0,0, 134, 3,2,1, 49,"隶书")
    绝对没问题.你是字符集和pitch_and_family没设好
      

  4.   

    OnCreate是不会运行的,除非你用Create方法自己创建一个控件才会调用OnCreate。
    建议在构造函数中初始化CFont 成员和设置Font属性
    CMyEdit::CMyEdit()
    {
        m_font.CreateFont(...);
        this->SetFont(&m_font);
    }
      

  5.   

    HFONT MyCreateFont( void ) 

        CHOOSEFONT cf; 
        LOGFONT lf; 
        HFONT hfont; 
     
        // Initialize members of the CHOOSEFONT structure. 
     
        cf.lStructSize = sizeof(CHOOSEFONT); 
        cf.hwndOwner = (HWND)NULL; 
        cf.hDC = (HDC)NULL; 
        cf.lpLogFont = &lf; 
        cf.iPointSize = 0; 
        cf.Flags = CF_SCREENFONTS; 
        cf.rgbColors = RGB(0,0,0); 
        cf.lCustData = 0L; 
        cf.lpfnHook = (LPCFHOOKPROC)NULL; 
        cf.lpTemplateName = (LPSTR)NULL; 
        cf.hInstance = (HINSTANCE) NULL; 
        cf.lpszStyle = (LPSTR)NULL; 
        cf.nFontType = SCREEN_FONTTYPE; 
        cf.nSizeMin = 0; 
        cf.nSizeMax = 0; 
     
        // Display the CHOOSEFONT common-dialog box. 
     
        ChooseFont(&cf); 
     
        // Create a logical font based on the user's 
        // selection and return a handle identifying 
        // that font. 
     
        hfont = CreateFontIndirect(cf.lpLogFont); 
        return (hfont); 
    }
      

  6.   

    HFONT hf=MyCreateFont();
    CFont cf;
    cf.m_hObject=hf;
    pDC->SelectObject(&cf);
    pDC->TextOut(0,0,"谢谢",0);