OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The font common dialog box lets you choose a font to use in your application, including the typeface, size, style, and so on.
For example, a word processor might use the font common dialog box to choose the font for a paragraph. TChooseFontDialog::TData has several members you must initialize before constructing the dialog box object:
TData member | Type | Description |
DC | HDC | A handle to the device context of the printer whose fonts you want to select, if you specify CF_PRINTERFONTS in Flags. Otherwise ignored. |
LogFont | LOGFONT | A handle to a LOGFONT that specifies the font's appearance. When you execute the dialog box and specify the flag CF_INITTOLOGFONTSTRUCT, the dialog box appears with the specified font (or the closest possible match) as the default. When the user closes the dialog box, LogFont is filled with the selections the user made. |
PointSize | int | The point size of the selected font (in tenths of a point). On input, it sets the size of the default font. On output, it returns the size the user selected. |
Color | TColor | The color of the selected font, if the CF_EFFECTS flag is set. On input, it sets the color of the default font. On output, it holds the color the user selected. |
Style | char far* | Lets you specify the style of the dialog. |
FontType | uint16 | A set of flags describing the styles of the selected font. Set only on output. |
SizeMin | int | Specifies the minimum and maximum Point sizes (in tenths of a point) the user can select, if the CF_LIMITSIZE flag is set. |
SizeMax | int |
In this example, a font common dialog box is used to set the window object's Font member, which is used elsewhere to paint text in the window. Note how a new font object is constructed using TFont.