gdi创建字体例子

    LOGFONT lf;
    lf.lfHeight         = 50 ; 
    lf.lfWidth          = 0 ; 
    lf.lfEscapement     = 0 ; 
    lf.lfOrientation    = 0 ; 
    lf.lfWeight         = 700 ; 
    lf.lfItalic         = 1 ; 
    lf.lfUnderline      = 1 ; 
    lf.lfStrikeOut      = 1 ; 
    lf.lfCharSet        = DEFAULT_CHARSET ; 
    lf.lfOutPrecision   = 0 ; 
    lf.lfClipPrecision  = 0 ; 
    lf.lfQuality        = 0 ; 
    lf.lfPitchAndFamily = 0 ; 
    TCHAR *fn = TEXT("黑体");
    lstrcpy (lf.lfFaceName, fn) ; 
    HFONT font = CreateFontIndirect(&lf);
    SelectObject(hdc,font);

    TextOut(hdc,0,0,"微软雅黑hd                     fhhgfhfg",35);

    LOGFONT lf;
    lf.lfHeight         = 50 ; 
    lf.lfWidth          = 0 ; 
    lf.lfEscapement     = 0 ; 
    lf.lfOrientation    = 0 ; 
    lf.lfWeight         = 700 ; 
    lf.lfItalic         = 1 ; 
    lf.lfUnderline      = 1 ; 
    lf.lfStrikeOut      = 1 ; 
    lf.lfCharSet        = DEFAULT_CHARSET ; 
    lf.lfOutPrecision   = 0 ; 
    lf.lfClipPrecision  = 0 ; 
    lf.lfQuality        = 0 ; 
    lf.lfPitchAndFamily = 0 ; 
    TCHAR *fn = TEXT("黑体");
    lstrcpy (lf.lfFaceName, fn) ; 
    HFONT font = CreateFontIndirect(&lf);
    SelectObject(hdc,font);

    BeginPath(hdc);
    TextOut(hdc,0,0,"微软雅黑hd                     fhhgfhfg",35);
    EndPath(hdc);
    StrokePath(hdc);

你可能感兴趣的:(DI)