Class Font

Font class

Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.

public sealed class Font : IDisposable

Constructors

NameDescription
Font(Font, FontStyle)Initializes a new instance of the Font class uses the specified existing Font and FontStyle enumeration..
Font(FontFamily, float)Initializes a new instance of the Font class.
Font(string, float)Initializes a new instance of the Font class using a specified size.
Font(FontFamily, float, FontStyle)Initializes a new instance of the Font class using a specified size and style..
Font(FontFamily, float, GraphicsUnit)Initializes a new instance of the Font class using a specified size and unit. Sets the style to Regular.
Font(string, float, FontStyle)Initializes a new instance of the Font class using a specified size and style.
Font(string, float, GraphicsUnit)Initializes a new instance of the Font class using a specified size and unit. The style is set to Regular.
Font(FontFamily, float, FontStyle, GraphicsUnit)Initializes a new instance of the Font class using a specified size, style, and unit.
Font(string, float, FontStyle, GraphicsUnit)Initializes a new instance of the Font class using a specified size, style, and unit.
Font(FontFamily, float, FontStyle, GraphicsUnit, byte)Initializes a new instance of the Font class using a specified size, style, unit, and character set..
Font(string, float, FontStyle, GraphicsUnit, byte)Initializes a new instance of the Font class using a specified size, style, unit, and character set.
Font(FontFamily, float, FontStyle, GraphicsUnit, byte, bool)Initializes a new instance of the Font class using a specified size, style, unit, and character set..
Font(string, float, FontStyle, GraphicsUnit, byte, bool)Initializes a new instance of the Font class using the specified size, style, unit, and character set.

Properties

NameDescription
Bold { get; }Gets a value indicating whether this Font is bold.
FontFamily { get; }Gets the FontFamily associated with this Font.
GdiCharSet { get; }Gets a byte value that specifies the GDI character set that this Font uses.
GdiVerticalFont { get; }Gets a value indicating whether this Font is derived from a GDI vertical font..
Height { get; }Gets the line spacing of this font.
IsSystemFont { get; }Gets a value indicating whether the font is a member of SystemFonts.
Italic { get; }Gets a value indicating whether this Font is italic.
Name { get; }Gets the face name of this Font.
OriginalFontName { get; }Gets the name of the font originally specified.
Size { get; }Gets the em-size of this Font measured in the units specified by the Unit property.
SizeInPoints { get; }Gets the em-size, in points, of this Font.
Strikeout { get; }Gets a value indicating whether this Font specifies a horizontal line through the font.
Style { get; }Gets style information for this Font.
SystemFontName { get; }Gets the name of the system font if the IsSystemFont property returns true.
Underline { get; }Gets a value indicating whether this Font is underlined.
Unit { get; }Gets the unit of measure for this Font.

Methods

NameDescription
Clone()Creates an exact copy of this Font.
Dispose()Releases all resources used by this Font.
override Equals(object)Indicates whether the specified object is a Font and has the same FontFamily, GdiVerticalFont, GdiCharSet, Style, Size, and Unit property values as this Font.
override GetHashCode()Gets the hash code for this Font.
GetHeight()Returns the line spacing, in pixels, of this font.
GetHeight(float)Returns the height, in pixels, of this Font when drawn to a device with the specified vertical resolution.
GetHeight(Graphics)Returns the line spacing, in the current unit of a specified Graphics, of this font.
override ToString()Returns a human-readable string representation of this Font.

See Also