不知道你知不知道字体的本质,你如果想改变字体的显示效果,请去查阅以下几个词的意思和例子,你就会搞定的:
CFont
HFONT
LOGFONT
……

解决方案 »

  1.   

    CreateFont
    then
    pDC->Select(pTheFont);
      

  2.   

    我的程序实现字体输出的语句是TextOut(hdc,480,520,str,strlen(str)),我想让字体比原来的再大一些,应该怎么设定呢?
      

  3.   

    先CreateFont,然后将子变量(Heiht,Widht,..还有字体等,具体看MSDN)设为你需要的值,然后将其选入该dc(是SetFont还是SelectObject()??),再用TextOut()就可以了,
      

  4.   

    我给你看一段vb的例子,vc也一样,你如法炮制就可以了:
    Private LF As LOGFONT
    ……
    With LF                        
        .lfUnderline = m_Font.Underline       ‘Font Underline
        .lfStrikeOut = m_Font.Strikethrough    'Font Strikethrough
        .lfItalic = m_Font.Italic              'Font Italic
        .lfFaceName = m_Font.Name              'Font Name
        .lfCharSet = m_Font.Charset            'Font Charset
        .lfWeight = m_Font.Weight              'Font Weight
        .lfHeight = m_Font.Size                'Font Size
        ……
    End WithlFont = CreateFontIndirect(LF)
    SelectObject .hdc, lFont
    TextOut(hdc,480,520,str,strlen(str)), 
                       
    DeleteObject lFont
      

  5.   

    我觉得还是CreatePointFont比较好使,只须两个参数,嘻嘻。
    CFont font;
    font.CreatePointFont(500, "MyFont");
    pDC->SelectObject(font);
      

  6.   

    请帮忙看一下:我的程序这样写的,编译通过,但是没有实现增大字体的愿望,是什么原因呢?
    TCHAR str[60]="欢迎你来到我的天堂!";
    strcat(str,zonghe[webfreq]);
    HDC hdc = ::GetDC(HWND_DESKTOP);
    CreateFont(
    10,  // logical height of font
    10,  // logical average character width
    0,  // angle of escapement
    0,  // base-line orientation angle
    FW_NORMAL,  // font weight
    TRUE,  // italic attribute flag
    FALSE, // underline attribute flag
    FALSE, // strikeout attribute flag
    DEFAULT_CHARSET,  // character set identifier
    OUT_CHARACTER_PRECIS,  // output precision
    CLIP_DEFAULT_PRECIS,  // clipping precision
    DEFAULT_QUALITY,    // output quality
    FF_DECORATIVE,  // pitch and family
    str   // pointer to typeface name string
    );
    SelectObject(
    hdc,      // handle to device context
    str   // handle to object
    );
      SetBkMode(hdc,TRANSPARENT);
    SetTextColor(hdc,RGB(200,255,70));
    TextOut(hdc,480,520,str,strlen(str));
      

  7.   

    你的代码有几处错误,我已更正,并已调试通过,成功!TCHAR str[60]="欢迎你来到我的天堂!";
    strcat(str,zonghe[webfreq]);
    HDC hdc = ::GetDC(HWND_DESKTOP);
    CFont font;
    font.CreateFont(
    24,  // logical height of font
    24,  // logical average character width
    0,  // angle of escapement
    0,  // base-line orientation angle
    FW_BOLD,  // font weight
    TRUE,  // italic attribute flag
    FALSE, // underline attribute flag
    FALSE, // strikeout attribute flag
    DEFAULT_CHARSET,  // character set identifier
    OUT_CHARACTER_PRECIS,  // output precision
    CLIP_DEFAULT_PRECIS,  // clipping precision
    DEFAULT_QUALITY,    // output quality
    FF_DECORATIVE,  // pitch and family
    "Arial"  // pointer to typeface name string
    );
    SelectObject(
    hdc,      // handle to device context
    font  // handle to object
    );
    SetBkMode(hdc,TRANSPARENT);
    SetTextColor(hdc,RGB(200,255,70));
    TextOut(hdc,480,520,str,strlen(str));
      

  8.   

    to NiceFeather:
    我的程序是用API的,不是用MFC的,编译起来老提示我程序里面的CFont没有定义:
    error C2065: 'CFont' : undeclared identifier
    遇到这种情况应该怎么办?我是个新手,还没试过解决这样的情况。
      

  9.   

    TCHAR str[60]="欢迎你来到我的天堂!";
    strcat(str,zonghe[webfreq]);
    HDC hdc = ::GetDC(HWND_DESKTOP);
    //CFont font;
    HFONT font= ::CreateFont(
    24,  // logical height of font
    24,  // logical average character width
    0,  // angle of escapement
    0,  // base-line orientation angle
    FW_BOLD,  // font weight
    TRUE,  // italic attribute flag
    FALSE, // underline attribute flag
    FALSE, // strikeout attribute flag
    DEFAULT_CHARSET,  // character set identifier
    OUT_CHARACTER_PRECIS,  // output precision
    CLIP_DEFAULT_PRECIS,  // clipping precision
    DEFAULT_QUALITY,    // output quality
    FF_DECORATIVE,  // pitch and family
    "Arial"  // pointer to typeface name string
    );
    SelectObject(
    hdc,      // handle to device context
    font  // handle to object
    );
    SetBkMode(hdc,TRANSPARENT);
    SetTextColor(hdc,RGB(200,255,70));
    TextOut(hdc,480,520,str,strlen(str));还有什么问题吗?