Visual Basic Reference
Return or set font styles in the following formats: Bold, Italic, Strikethru, and Underline.
Note The FontBold, FontItalic, FontStrikethru, and FontUnderline properties are included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic. For additional functionality, use the new Font object properties (not available for the CommonDialog control).
object.FontBold [= boolean]
object.FontItalic [= boolean]
object.FontStrikethru [= boolean]
object.FontUnderline [= boolean]
The FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes have these parts:
|object||An object expression that evaluates to an object in the Applies To list.|
|boolean||A Boolean expression specifying the font style as described in Settings.|
The settings for boolean are:
|True||(Default for FontBold, except with the CommonDialog control) Turns on the formatting in that style.|
|False||(Default for FontItalic, FontStrikethru, and FontUnderline, and FontBold with the CommonDialog control) Turns off the formatting in that style.|
Use these font properties to format text, either at design time using the Properties window or at run time using code. For PictureBox controls and Form and Printer objects, setting these properties doesn't 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 operating environment uses a different font for TrueType fonts that are smaller than 8 points.