Visual Basic: CommonDialog Control

Flags Property (Font Dialog)

See Also   Example   Applies To

Returns or sets the options for the Font dialog box.

Syntax

object**.Flags** [= value]

The Flags property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value A constant or value specifying the options for a Font dialog box, as described in Settings.

Settings

The settings for value are:

Constant Value Description
cdlCFANSIOnly &H400 Specifies that the dialog box allows only a selection of the fonts that use the Windows character set. If this flag is set, the user won't be able to select a font that contains only symbols.
cdlCFApply &H200 Enables the Apply button on the dialog box.
cdlCFBoth &H3 Causes the dialog box to list the available printer and screen fonts. The hDC property identifies the device context associated with the printer.
cdlCFEffects &H100 Specifies that the dialog box enables strikethrough, underline, and color effects.
cdlCFFixedPitchOnly &H4000 Specifies that the dialog box selects only fixed-pitch fonts.
cdlCFForceFontExist &H10000 Specifies that an error message box is displayed if the user attempts to select a font or style that doesn't exist.
cdlCFHelpButton &H4 Causes the dialog box to display a Help button.
cdlCFLimitSize &H2000 Specifies that the dialog box selects only font sizes within the range specified by the Min and Max properties.
cdlCFNoFaceSel &H80000 No font name selected.
cdlCFNoSimulations &H1000 Specifies that the dialog box doesn't allow graphic device interface (GDI) font simulations.
cdlCFNoSizeSel &H200000 No font size selected.
cdlCFNoStyleSel &H100000 No style was selected.
cdlCFNoVectorFonts &H800 Specifies that the dialog box doesn't allow vector-font selections.
cdlCFPrinterFonts &H2 Causes the dialog box to list only the fonts supported by the printer, specified by the hDC property.
cdlCFScalableOnly &H20000 Specifies that the dialog box allows only the selection of fonts that can be scaled.
cdlCFScreenFonts &H1 Causes the dialog box to list only the screen fonts supported by the system.
cdlCFTTOnly &H40000 Specifies that the dialog box allows only the selection of TrueType fonts.
cdlCFWYSIWYG &H8000 Specifies that the dialog box allows only the selection of fonts that are available on both the printer and on screen. If this flag is set, the cdlCFBoth and cdlCFScalableOnly flags should also be set.

Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object Browser.

You can also define selected flags. Use the Const keyword in the Declarations section of the startup form to define the flags you want to use. For example:

Const ReadOnly  = &H00000001&
Const Effects  = &H00000100&

You can set more than one flag for a dialog box using the Or operator. For example:

CommonDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results. The following is equivalent to the preceding example:

CommonDialog1.Flags = &H210&

Note   You must set the Flags property to cdlCFScreenFonts, cdlCFPrinterFonts, or cdlCFBoth before displaying the Fonts dialog box. Otherwise, the error No Fonts Exist occurs.

Data Type

Long