Returns or sets font styles in the following formats: Bold, Italic, Strikethru, and Underline.
object.FontBold [= boolean]
object.FontItalic [= boolean]
object.FontStrikethru [= boolean]
object.FontUnderline [= boolean]
The parts of the FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes are described in the following table.
Part | Description |
---|---|
object | An object expression that evaluates to an object. |
boolean | A Boolean expression specifying the font style as described in Settings. |
The settings for boolean are described in the following table.
Setting | Description |
---|---|
True | Turns on the formatting in that style (default for FontBold, except with the CommonDialog and TreeView controls). |
False | Turns off the formatting in that style (default for FontItalic, FontStrikethru, FontUnderline.) |
Use these font properties to format text, either at design time using the Properties window or at run time using code. For Form object, setting these properties does not affect graphics or text already drawn on the control or object. For all other controls, font changes take effect on screen immediately.
To use these properties with the CommonDialog control, the Effects flag must be set.
Note Fonts available in Visual Basic vary depending on your system configuration, display devices, and printing devices. Font-related properties can be set only to values for which actual fonts exist.
In general, you should change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property. The Microsoft Windows CE operating environment uses a different font for TrueType fonts that are smaller than 8 points.