Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

The Font Dialog Box

To display a Font dialog box, you only need to change the DialogTitle property, select a default font name and style if you want, set the kind of font to display, and then use the ShowFont method, like this:

cdbDialog.DialogTitle = "Font"
cdbDialog.FontName = "Arial"
cdbDialog.Flags = cdlCFEffects Or cdlCFBoth
cmdDialog.ShowFont

The Type property is required, or you will cause the error shown in Figure 12.10. cdlCFEffects and cdlCFBoth are named literals that you can use with the Font dialog box. These literals tell Visual Basic to display the user's TrueType fonts as well as any printer and screen fonts that appear on the system.

12fig10.gif

Figure 12.10 The Font dialog box cannot find the correct fonts.

Share ThisShare This

Informit Network