FontFamily Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines a group of type faces having a similar basic design and certain variations in styles. This class cannot be inherited.
public ref class FontFamily sealed : MarshalByRefObject, IDisposable
public sealed class FontFamily : MarshalByRefObject, IDisposable
type FontFamily = class
inherit MarshalByRefObject
interface IDisposable
Public NotInheritable Class FontFamily
Inherits MarshalByRefObject
Implements IDisposable
- Inheritance
- Implements
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 = Point(40,120);
System::Collections::IEnumerator^ myEnum = FontFamily::Families->GetEnumerator();
while ( myEnum->MoveNext() )
{
FontFamily^ oneFontFamily = safe_cast<FontFamily^>(myEnum->Current);
listBox1->Items->Add( oneFontFamily->Name );
}
}
private void PopulateListBoxWithFonts()
{
listBox1.Width = 200;
listBox1.Location = new Point(40, 120);
foreach ( FontFamily oneFontFamily in FontFamily.Families )
{
listBox1.Items.Add(oneFontFamily.Name);
}
}
Private Sub PopulateListBoxWithFonts()
listBox1.Width = 200
listBox1.Location = New Point(40, 120)
Dim oneFontFamily As FontFamily
For Each oneFontFamily In FontFamily.Families
listBox1.Items.Add(oneFontFamily.Name)
Next
End Sub
Note
In .NET 6 and later versions, the System.Drawing.Common package, which includes this type, is only supported on Windows operating systems. Use of this type in cross-platform apps causes compile-time warnings and run-time exceptions. For more information, see System.Drawing.Common only supported on Windows.
Font |
Initializes a new FontFamily from the specified generic font family. |
Font |
Initializes a new FontFamily in the specified FontCollection with the specified name. |
Font |
Initializes a new FontFamily with the specified name. |
Families |
Returns an array that contains all the FontFamily objects associated with the current graphics context. |
Generic |
Gets a generic monospace FontFamily. |
Generic |
Gets a generic sans serif FontFamily object. |
Generic |
Gets a generic serif FontFamily. |
Name |
Gets the name of this FontFamily. |
Create |
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject) |
Dispose() |
Releases all resources used by this FontFamily. |
Equals(Object) |
Indicates whether the specified object is a FontFamily and is identical to this FontFamily. |
Finalize() |
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. |
Get |
Returns the cell ascent, in design units, of the FontFamily of the specified style. |
Get |
Returns the cell descent, in design units, of the FontFamily of the specified style. |
Get |
Gets the height, in font design units, of the em square for the specified style. |
Get |
Obsolete.
Obsolete.
Returns an array that contains all the FontFamily objects available for the specified graphics context. |
Get |
Gets a hash code for this FontFamily. |
Get |
Obsolete.
Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject) |
Get |
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. |
Get |
Returns the name, in the specified language, of this FontFamily. |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Initialize |
Obsolete.
Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject) |
Is |
Indicates whether the specified FontStyle enumeration is available. |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject) |
To |
Converts this FontFamily to a human-readable string representation. |
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: