Freigeben über


The Font Object

The system provides a standard implementation of the font object. The standard font object supports a number of read-write properties as well as a set of methods through its IFont interface. The standard font object implementation exposes an event interface, IFontEventsDisp.

The standard font object has the following properties:

Property name Return type Description
Application
VT_DISPATCH
Returns the Application object; read only.
Bold
VT_BOOL
Sets or returns True if the font is bold, otherwise False; read/write.
Charset
VT_I2
The character set used in the font, such as ANSI_CHARSET, DEFAULT_CHARSET, or SYMBOL_CHARSET.
Italic
VT_BOOL
Sets or returns True if the font is italic; otherwise False, read/write.
Name
VT_BSTR
Returns the name of the font; read only.
Parent
VT_DISPATCH
Returns the parent of the Font object; read only.
Size
VT_CY
Sets or returns the point size of the font; read/write.
Strikethrough
VT_BOOL
Sets or returns True if the font appears with a line running through it, otherwise False; read/write.
Underline
VT_BOOL
Sets or returns True if the font is italic otherwise False, read/write.
Weight
VT_I2
The boldness or weight of the font.

The standard font object implementation exposes a new event interface, IFontEventsDisp. This event contains FontChanged, which notifies the font object that its font resource has changed:

Event name Description
FontChanged(PropertyName as String)
This event is contained in the IFontEventsDisp interface. The event is called whenever a property of the font object is changed. The PropertyName parameter will contain the English name of the property that has been changed in Visual Basic or the DISPID of the changed property in C and C++.

For more information on font object properties, see IFont.

For more information on IFontDisp, see IFontDisp.