How to set the default font name when I call ChooseFont(..) ?
-
Hello Everybody ! when I call the system font dialog like this,how to set the default font name and size ?
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. // How to set the defalut font name or size before call this function??? 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);
}
Thanks for your reply ! Best Regards !
-
Hello Everybody ! when I call the system font dialog like this,how to set the default font name and size ?
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. // How to set the defalut font name or size before call this function??? 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);
}
Thanks for your reply ! Best Regards !
It took me 10 seconds to google one word and find the answer, in the form of this sentence: If you set the ... flag in the Flags member and initialize the other members, the ChooseFont function initializes the dialog box with a font that matches ... :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
It took me 10 seconds to google one word and find the answer, in the form of this sentence: If you set the ... flag in the Flags member and initialize the other members, the ChooseFont function initializes the dialog box with a font that matches ... :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
:~ I'm sorry... thanks !
-
:~ I'm sorry... thanks !
No problem. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.