JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Font Dialogs

Font dialogs let the user select a font size, face, color, and so on. You can see a font dialog box at work in Figure 9.5 from the FontDialog example on the CD-ROM.

Click To expand
Figure 9.5: A font dialog box.

What's handy about these dialogs, besides the fact that they're the same as those used by Windows, is that they return Font and Color objects directly (using the properties of the same name), ready for installation in controls that can use them, like rich text boxes. This saves you the trouble of creating and configuring these objects from scratch.

To display the font dialog box, call the ShowDialog method. This dialog shows list boxes for Font, Style, and Size, checkboxes for effects like Strikeout and Underline, a drop-down list for Script (Script refers to different character scripts that are available for a given font—for example, Hebrew), and a sample of how the font will appear. You can recover these settings using properties of the same names of the Font object returned by the Font property.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor