// 贴上我的一段程序HFONT FAR PASCAL MyCreateFont( void )
{
CHOOSEFONT cf;
LOGFONT lf;
HFONT hfont; // Initialize members of the CHOOSEFONT structure.
cf.lStructSize = sizeof(CHOOSEFONT);
cf.hwndOwner = (HWND)NULL;
cf.hDC = (HDC)NULL;
cf.lpLogFont = &lf;
cf.iPointSize = 0;
cf.Flags = CF_SCREENFONTS;
cf.rgbColors = RGB(0,0,0);
cf.lCustData = 0L;
cf.lpfnHook = (LPCFHOOKPROC)NULL;
cf.lpTemplateName = (LPSTR)NULL;
cf.hInstance = (HINSTANCE) NULL;
cf.lpszStyle = (LPSTR)NULL;
cf.nFontType = SCREEN_FONTTYPE;
cf.nSizeMin = 0;
cf.nSizeMax = 0; // Display the CHOOSEFONT common-dialog box.
// 显示字体选择对话框,由用户选择字体
ChooseFont(&cf); // Create a logical font based on the user's
// selection and return a handle identifying
// that font. hfont = CreateFontIndirect(cf.lpLogFont);
return (hfont);
}void CMyDialogDlg::OnDown()
{
// TODO: Add your control notification handler code here
CDC *pDC;
HDC hDC;
HFONT hFONT; pDC=GetDC();
hDC=pDC->m_hDC; hFONT=MyCreateFont();
SelectObject(hDC, hFONT); SetBkColor(hDC,RGB(0,0,0));
SetTextColor(hDC,RGB(200,200,100));
TextOut(hDC,nXstart,nYstart,myString,nLenth);
// ....
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货