初始化對話方塊時先 addfontresource(l"\\sdmmc\\msyh.ttf"); (sdmmc是sd卡路徑下)
然後在繪製函式裡面新增你要加的onpaint() 為了防止重繪,所以先建立記憶體dc
logfont lf;
int noldbkmode;
hfont hfontold, hfontnew;
// create the font.
memset(&lf, 0, sizeof(lf));
lf.lfheight = -19;
lf.lfweight = 700;
lf.lfcharset = gb2312_charset;
lf.lfoutprecision= out_default_precis;
lf.lfclipprecision= clip_stroke_precis;
lf.lfquality = antialiased_quality;
lf.lfpitchandfamily= default_pitch|ff_modern;
_tcscpy(lf.lffacename, l"微軟雅黑");
hfontnew = createfontindirect(&lf);
rect rc;
hdc hmemdc, hsrcdc;
hbitmap hmembmp, holdmembmp;
hbitmap hsrcbmp, holdsrcbmp;
int nwidth, nheight;
tchar szwndtitle[max_loadstring];
getclientrect(hwnd, &rc);
nwidth = rc.right - rc.left;
nheight = rc.bottom - rc.top;
// create memory objects
hmemdc = createcompatibledc(hdc);
hmembmp = createcompatiblebitmap(hdc, nwidth, nheight);
holdmembmp = (hbitmap)selectobject(hmemdc, hmembmp);
// draw background
hsrcbmp = loadbitmap(afxgetinstancehandle(), makeintresource(idb_bitmap1)); //預設設定一張底圖
if(hsrcbmp != null)
// display the composed picture
bitblt(hdc, 0, 0, nwidth, nheight, hmemdc, 0, 0, srccopy);
// delete memory objects
selectobject(hmemdc, holdmembmp);
selectobject(hmemdc,hfontold);
deleteobject(hmembmp);
deletedc(hmemdc);
最後析構的時候移除字型
removefontresource(l"\\sdmmc\\msyh.ttf");
Xcode新增字型庫
新增自定義字型的方法 2 把這個檔案新增到工程裡面 4 新增成功後,就可以使用啦。但是我只拿到這個庫,並不清楚fontname。用下面這段 列印出來系統可用字型。nsarray familynames nsarrayalloc initwitharray uifontfamilynames nsar...
WINCE6 0新增特定的軟體鍵盤
前天因客戶的需要,需要在wince6.0的系統中新增以色列語言的鍵盤到系統中,本以為是很簡單的事情,因為之前在wince5.0下也有做過在系統中增加鍵盤的經歷了,所需要的工作如下 在plarform.bib中加入下面的內容 if bsp hebrew largekb.dll flatreleased...
WINCE6 0新增特定的軟體鍵盤
前天因客戶的需要,需要在wince6.0的系統中新增以色列語言的鍵盤到系統中,本以為是很簡單的事情,因為之前在wince5.0下也有做過在系統中增加鍵盤的經歷了,所需要的工作如下 1.在plarform.bib中加入下面的內容 if bsp hebrew largekb.dll flatreleas...