Home > Net >  New calls for great god answer font resources.
New calls for great god answer font resources.

Time:11-28

 
Void CMFCDlg: : OnBnClickedButton1 ()
{
//TODO: add the control notification handler code

HANDLE m_resourceFont;
HINSTANCE hResInstance=AfxGetResourceHandle ();
HRSRC res=FindResource (hResInstance, MAKEINTRESOURCE (IDR_Myfont), _T (" the vera.ttf "));
If (res)
{
HGLOBAL mem=LoadResource (hResInstance, res);
Void * data=https://bbs.csdn.net/topics/LockResource (mem);
DWORD len=SizeofResource (hResInstance, res);
DWORD nFonts=0;
M_resourceFont=AddFontMemResourceEx (data, len, NULL, & amp; NFonts);
if (! M_resourceFont)
AfxMessageBox (_T (" font loading failure!" ));
}
The else
{
AfxMessageBox (_T (" font loading failure!" ));
}



M_Font. CreateFont (
28,//nHeight
0,//nWidth
0,//nEscapement
0,//nOrientation
FW_NORMAL,//nWeight
FALSE,//bItalic
FALSE,//bUnderline
0,//cStrikeOut
ANSI_CHARSET,//nCharSet
OUT_DEFAULT_PRECIS,//nOutPrecision
CLIP_DEFAULT_PRECIS,//nClipPrecision
DEFAULT_QUALITY,//nQuality
DEFAULT_PITCH | FF_SWISS,//nPitchAndFamily
_T (" founder director circle "));//lpszFacename
GetDlgItem (IDC_EDIT1) - & gt; The SetFont (& amp; M_Font);
GetDlgItem (IDC_EDIT1) - & gt; UpdateWindow ();

//AfxMessageBox (_T (" ok "));

M_Font. DeleteObject ();


}


Why font loading is successful, the following setfont doesn't call the founder director circle font, strives for the great god answer, thank you.

CodePudding user response:

M_Font. DeleteObject (); Comment out the try,
  • Related