FontFamily Class
Collapse the table of content
Expand the table of content

FontFamily Class

 

Defines a group of type faces having a similar basic design and certain variations in styles. This class cannot be inherited.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

System.Object
  System.MarshalByRefObject
    System.Drawing.FontFamily

public sealed class FontFamily : MarshalByRefObject, IDisposable

NameDescription
System_CAPS_pubmethodFontFamily(GenericFontFamilies)

Initializes a new FontFamily from the specified generic font family.

System_CAPS_pubmethodFontFamily(String)

Initializes a new FontFamily with the specified name.

System_CAPS_pubmethodFontFamily(String, FontCollection)

Initializes a new FontFamily in the specified FontCollection with the specified name.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticFamilies

Returns an array that contains all the FontFamily objects associated with the current graphics context.

System_CAPS_pubpropertySystem_CAPS_staticGenericMonospace

Gets a generic monospace FontFamily.

System_CAPS_pubpropertySystem_CAPS_staticGenericSansSerif

Gets a generic sans serif FontFamily object.

System_CAPS_pubpropertySystem_CAPS_staticGenericSerif

Gets a generic serif FontFamily.

System_CAPS_pubpropertyName

Gets the name of this FontFamily.

NameDescription
System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by this FontFamily.

System_CAPS_pubmethodEquals(Object)

Indicates whether the specified object is a FontFamily and is identical to this FontFamily.(Overrides Object.Equals(Object).)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Overrides Object.Finalize().)

System_CAPS_pubmethodGetCellAscent(FontStyle)

Returns the cell ascent, in design units, of the FontFamily of the specified style.

System_CAPS_pubmethodGetCellDescent(FontStyle)

Returns the cell descent, in design units, of the FontFamily of the specified style.

System_CAPS_pubmethodGetEmHeight(FontStyle)

Gets the height, in font design units, of the em square for the specified style.

System_CAPS_pubmethodSystem_CAPS_staticGetFamilies(Graphics)

Obsolete.Returns an array that contains all the FontFamily objects available for the specified graphics context.

System_CAPS_pubmethodGetHashCode()

Gets a hash code for this FontFamily.(Overrides Object.GetHashCode().)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetLineSpacing(FontStyle)

Returns the line spacing, in design units, of the FontFamily of the specified style. The line spacing is the vertical distance between the base lines of two consecutive lines of text.

System_CAPS_pubmethodGetName(Int32)

Returns the name, in the specified language, of this FontFamily.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodIsStyleAvailable(FontStyle)

Indicates whether the specified FontStyle enumeration is available.

System_CAPS_pubmethodToString()

Converts this FontFamily to a human-readable string representation.(Overrides Object.ToString().)

The following code example shows all the font families in the Families property of the FontFamily class. This example is designed to be used with a Windows Form. To run this example, add a ListBox named listBox1 to a form and call the PopulateListBoxWithFonts method from the form's constructor.

private void PopulateListBoxWithFonts()
{
    listBox1.Width = 200;
    listBox1.Location = new Point(40, 120);
    foreach ( FontFamily oneFontFamily in FontFamily.Families )
    {
        listBox1.Items.Add(oneFontFamily.Name);
    }
}

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft