This documentation is archived and is not being maintained.

FontFamily.GetName Method

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

[Visual Basic]
Public Function GetName( _
   ByVal language As Integer _
) As String
[C#]
public string GetName(
 int language
);
[C++]
public: String* GetName(
 int language
);
[JScript]
public function GetName(
   language : int
) : String;

Parameters

language
The language in which the name is returned.

Return Value

A String object that represents the name, in the specified language, of this FontFamily object. It creates a FontFamily object, gets the name of that font family, and then draws the name to the screen as text.

Example

[Visual Basic, C#] The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a FontFamily object.
  • Gets the name of the font family.
  • Draws the name of the font family to the screen as text.
[Visual Basic] 
Public Sub GetName_Example(e As PaintEventArgs)
' Create a FontFamily object.
Dim myFontFamily As New FontFamily("Arial")
' Get the name of myFontFamily.
Dim familyName As String = myFontFamily.GetName(0)
' Draw the name of the myFontFamily to the screen as a string.
e.Graphics.DrawString("The family name is " & familyName, _
New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub
        
[C#] 
public void GetName_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily myFontFamily = new FontFamily("Arial");
// Get the name of myFontFamily.
string familyName = myFontFamily.GetName(0);
// Draw the name of the myFontFamily to the screen as a string.
e.Graphics.DrawString(
"The family name is " + familyName,
new Font(myFontFamily, 16),
Brushes.Black,
new PointF(0, 0));
}
        

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

FontFamily Class | FontFamily Members | System.Drawing Namespace

Show: