CFont font; LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); // zero out structure lf.lfHeight = 20; // request a 12-pixel-height font strcpy(lf.lfFaceName, "宋体"); // request a face name "Arial" VERIFY(font.CreateFontIndirect(&lf)); // create the font// Do something with the font just created... CClientDC dc(this); CFont* def_font = dc.SelectObject(&font); dc.TextOut(5, 5, "Hello", 5); dc.SelectObject(def_font);// Done with the font. Delete the font object. font.DeleteObject();
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
lf.lfHeight = 20; // request a 12-pixel-height font
strcpy(lf.lfFaceName, "宋体"); // request a face name "Arial"
VERIFY(font.CreateFontIndirect(&lf)); // create the font// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.TextOut(5, 5, "Hello", 5);
dc.SelectObject(def_font);// Done with the font. Delete the font object.
font.DeleteObject();
如果单独的edit筐需要创建字体,然后连接
定义字体
创建字体
加载字体