Font Dialog Initialization Flags

Before calling ChooseFont, the Flags member of the CHOOSEFONT structure must specify CF_SCREENFONTS, CF_PRINTERFONTS, or CF_BOTH, to indicate whether the dialog box should list screen fonts, printer fonts, or both. If you specify CF_PRINTERFONTS or CF_BOTH, the hDC member of the CHOOSEFONT structure must specify a handle to a device context for the printer.

You can use the Flags member to enable or disable some of the dialog box controls, and you can use the Flags member in conjunction with other CHOOSEFONT members to control the initial values of some controls.

pics/WIN3200000004.gif To display the controls that allow the user to select strikeout, underline, and color options

  • Set the CF_EFFECTS flag. You can use the rgbColors member of the CHOOSEFONT structure to specify an initial font color.

pics/WIN3200000004.gif To specify the initial values of the Font, Font Style, Size, Strikeout, and Underline dialog box controls

  • Set the CF_INITTOLOGFONTSTRUCT flag to use members of the LOGFONT structure to specify the initial values.

  • You can also use the CF_NOFACESEL, CF_NOSTYLESEL, and CF_NOSIZESEL flags to selectively prevent the dialog box from displaying initial values for the corresponding controls. This is useful when working with a selection of text that has more than one typeface, style, or point size. These values will also be set in Flags when ChooseFont returns if the user did not select a corresponding value.

pics/WIN3200000004.gif To initialize the Font Style control to a specified style name

  • Set the CF_USESTYLE flag and use the lpszStyle member to specify the style name.

pics/WIN3200000004.gif To display the Apply button

  • Set the CF_APPLY flag and provide a hook procedure to process WM_COMMAND messages for the Apply button. The hook procedure can send the WM_CHOOSEFONT_GETLOGFONT message to the dialog box to retrieve the address of the LOGFONT structure that contains the current selections for the font.

pics/WIN3200000004.gif To display the Help button

  • Set the CF_SHOWHELP flag. The hwndOwner member must identify the window to receive the HELPMSGSTRING registered message when the user clicks the Help button.

pics/WIN3200000004.gif To restrict the fonts the dialog box displays

  • Set any combination of the CF_TTONLY, CF_FIXEDPITCHONLY, CF_NOVECTORFONTS, CF_NOVERTFONTS, CF_SCALABLEONLY, and CF_WYSIWYG flags. You can also restrict the available styles, point sizes, and effects the dialog box displays for some fonts by using the CF_NOSIMULATIONS value.

pics/WIN3200000004.gif To restrict the typeface names, styles, and point sizes that the user can specify

  • Set the CF_FORCEFONTEXIST flag to restrict the user to specifying only valid typeface names, styles, and point sizes.

  • Set the CF_LIMITSIZE flag to restrict the user to specifying point sizes in the range specified by the nSizeMin and nSizeMax members.

pics/WIN3200000004.gif To restrict or disable the Scripts combo box

  • Set the CF_NOSCRIPTSEL flag to disable the Scripts combo box, or set the CF_SELECTSCRIPT flag to restrict selections in the Scripts combo box to a specified character set.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database