CEdit的字体不能设为下划线吗(UnderLine = TRUE)?
我用CreateFont(13, 0, 0, 0, 0, TRUE....)
SetFont(&m_font)下划线不起作用????
斜体和中间线都可用。!

解决方案 »

  1.   

    那就从CEDIT继承,改写一个字符输出函数。
      

  2.   

    LOGFONT lf;
    memset(&lf,0,sizeof(LOGFONT));
    lf.lfHeight=TITLE_FONT_SIZE;
    _tcscpy(lf.lfFaceName,_T("宋体"));
    lf.lfWeight=600;
    lf.lfUnderline=TRUE; //下画线
    //lf.lfItalic=TRUE;  
    font.CreateFontIndirect(&lf);
             SetFont(&font);   试试,
    还有把编辑框拉大一点,看看!!
      

  3.   

    我是从CEdit继承的。
    字体大小什么的都从INI文件里读出来的。
    CreateFont(strFontName, 0, 0, 0, bItatic, bUnderLine, bStrikeOut,.....)
    SetFont(&m_font);
    不行。
    始终搞不懂!!!是不是中间的参数设置错了 ?譬如DEFAULT_....什么的
      

  4.   

    CFont* pFont = GetFont();
    if (!pFont)
    {
    HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
    if (hFont == NULL)
    hFont = (HFONT) GetStockObject(ANSI_VAR_FONT);
    if (hFont)
    pFont = CFont::FromHandle(hFont);
    }
    ASSERT(pFont->GetSafeHandle());    // Create the underline font
        LOGFONT lf;
        pFont->GetLogFont(&lf);
    m_StdFont.CreateFontIndirect(&lf);
        lf.lfUnderline = (BYTE) TRUE;
        m_UnderlineFont.CreateFontIndirect(&lf);
      

  5.   

    程序给我,我给你调一下,[email protected]
      

  6.   

    在派生的类里定义一个函数:
    void CMyEdit::setfont()
    {
    LOGFONT lf; //设置打开字体对话框的默认字体
    CFont *font=GetFont();//得到当前视图字体
    if(font==NULL)   //当前无字体,创建默认的字体
    {
    font =new CFont;
    font->CreatePointFont(120,"Fixedsys");
    font->GetLogFont(&lf); //初始化LOGFONT

    delete font;
    }
    else
    {
    font->GetLogFont(&lf); //初始化LOGFONT
    }

    lf.lfUnderline = true;
    lf.lfItalic = true;

    m_Font.DeleteObject();

    m_Font.CreateFontIndirect(&lf);
    SetFont(&m_Font);
    }
    然后:
    在对话框或者船体
    CMyEdit* m_new1 = new CMyEdit;

    // m_mystatic.SetCursor( ::LoadCursor(NULL, IDC_WAIT) );
    m_new1->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,CRect(10, 10, 100, 100), this,IDC_EDIT5);
    GetParentFrame()->RecalcLayout();
    m_new1->setfont(); 
    就可以