PrivateFontCollection.AddFontFile(String) Method

Definition

Adds a font from the specified file to this PrivateFontCollection.

public:
 void AddFontFile(System::String ^ filename);
public void AddFontFile (string filename);
member this.AddFontFile : string -> unit
Public Sub AddFontFile (filename As String)

Parameters

filename
String

A String that contains the file name of the font to add.

Exceptions

The specified font is not supported or the font file cannot be found.

Remarks

Windows Forms applications support TrueType fonts and have limited support for OpenType fonts. If you try to use a font that is not supported, such as an unsupported OpenType font or a Bitmap font, an exception will occur. The AddFontFile is not supported on operating systems before Windows 2000. When using a private font on operating systems before Windows 2000, the default font, typically Microsoft Sans Serif, will be substituted.

Applies to

See also