HFONT 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 = (LPWSTR)NULL; cf.hInstance = (HINSTANCE) NULL; cf.lpszStyle = (LPWSTR)NULL; cf.nFontType = SCREEN_FONTTYPE; cf.nSizeMin = 0; cf.nSizeMax = 0; // Display the CHOOSEFONT common-dialog box. ChooseFont(&cf);//select a font form the list ChooseFontDialog of MS's CommDlg // Create a logical font based on the user's // selection and return a handle identifying // that font. //cf.lpLogFont->lfOutPrecision=OUT_TT_ONLY_PRECIS; int err = GetLastError(); cf.lpLogFont->lfHeight=15; cf.lpLogFont->lfPitchAndFamily=2;//set not seam width hfont = CreateFontIndirect(cf.lpLogFont); err = GetLastError(); if(err>0) { MessageBox(NULL,L"Failed",L"wrong",MB_OK); } return (hfont); }
ChooseFont
lfPitchAndFamily
lf.lfPitchAndFamily
CF_INITTOLOGFONTSTRUCT
cf.Flags
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)