Font
System.Drawing.Font
Namespace: System.Drawing
Assembly: System.Drawing.Managed (4.0.0.0)
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
public class Font : MarshalByRefObject, ICloneable, IDisposable, ISerializablePublic Class Font
Inherits MarshalByRefObject
Implements ICloneable, IDisposable, ISerializableConstructors
Font(familyName, emSize)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
Font(familyName, emSize, style)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
Font(familyName, emSize, unit)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
Font(familyName, emSize, style, unit)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
Font(familyName, emSize, style, unit, gdiCharSet)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
Font(familyName, emSize, style, unit, gdiCharSet, gdiVerticalFont)
Initializes a new instance of the Font class.
gdiVerticalFont
A Boolean value indicating whether the new font is derived from a GDI vertical font.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
Font(prototype, newStyle)
Initializes a new instance of the Font class that uses the specified existing Font and FontStyle enumeration.
Font(family, emSize)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
ArgumentException family is
Font(family, emSize, style)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
ArgumentException family is
Font(family, emSize, unit)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
ArgumentException family is
Font(family, emSize, style, unit)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
ArgumentException family is
Font(family, emSize, style, unit, gdiCharSet)
Initializes a new instance of the Font class.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
ArgumentException family is
Font(family, emSize, style, unit, gdiCharSet, gdiVerticalFont)
Initializes a new instance of the Font class.
gdiVerticalFont
A Boolean value indicating whether the new font is derived from a GDI vertical font.
Throws:
ArgumentNullException emSize is less than or equal to 0, evaluates to infinity, or is not a valid number.
ArgumentException family is
Properties
Bold
Boolean: Gets a value indicating whether this Font is bold.
FontFamily
FontFamily: Gets the FontFamily associated with this Font.
GdiCharSet
Byte: Gets a byte value that specifies the GDI character set that this Font uses.
This property returns 1, unless a different character set is specified in the Font(String, Single, FontStyle, GraphicsUnit, Byte) constructor. This property takes a value from the list defined in the Windows SDK header file WinGDI.h. The character sets and byte values are listed in the following table. system.drawing.font
GdiVerticalFont
Boolean: Gets a value indicating whether this Font is derived from a GDI vertical font.
Use this property to determine if a font is compatible with native Win32 controls on non-Unicode platforms. GdiVerticalFont only returns true if this font was created from a classic GDI font definition, like a LOGFONT or HFONT.
Height
Int32: Gets the line spacing of this font.
IsSystemFont
Boolean: Gets a value indicating whether the font is a member of SystemFonts.
Italic
Boolean: Gets a value indicating whether this Font is italic.
Name
String: Gets the face name of this Font.
OriginalFontName
String: Gets the name of the font originally specified.
The actual font name and original font name can be different. System requirements may cause the use of a font other than the font originally specified.
Size
Single: Gets the em-size of this Font measured in the units specified by the Unit property.
SizeInPoints
Single: Gets the em-size, in points, of this Font.
Strikeout
Boolean: Gets a value indicating whether this Font specifies a horizontal line through the font.
Style
FontStyle: Gets style information for this Font.
SystemFontName
String: Gets the name of the system font if the IsSystemFont property returns true.
Underline
Boolean: Gets a value indicating whether this Font is underlined.
Unit
GraphicsUnit: Gets the unit of measure for this Font.
Methods
Clone()
Returns: Object.
Dispose()
Finalize()
Finalizes an instance of the Font class.
GetHeight()
Returns the line spacing of this font.
Returns: Single. The line spacing, in pixels, of this font.
GetHeight(graphics)
Returns the line spacing, in the current unit of a specified Graphics, of this font.
Returns: Single. The line spacing, in the graphics unit, of this font.
GetHeight(dpi)
Returns the height, in pixels, of this Font when drawn to a device with the specified vertical resolution.
Last updated
Was this helpful?