FontFamily.GetName-Methode
Gibt den Namen dieses FontFamily-Objekts in der angegebenen Sprache zurück.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Function GetName ( _
language As Integer _
) As String
'Usage
Dim instance As FontFamily
Dim language As Integer
Dim returnValue As String
returnValue = instance.GetName(language)
public string GetName (
int language
)
public:
String^ GetName (
int language
)
public String GetName (
int language
)
public function GetName (
language : int
) : String
Parameter
- language
Die Sprache, in der der Name zurückgegeben wird.
Rückgabewert
Ein String-Objekt, das den Namen für dieses FontFamily-Objekt in der angegebenen Sprache darstellt.
Hinweise
Geben Sie für den language-Parameter 0 (null) an, wenn die Angaben sprachneutral sein sollen. Eine Auflistung der verfügbaren Sprachen und Sprachvarianten finden Sie in der Headerdatei Winnt.h. Wenn Visual Studio installiert ist, ist diese Headerdatei im Allgemeinen relativ zum Installationsverzeichnis von Visual Studio unter \\VC\PlatformSDK\Include zu finden.
Beispiel
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert PaintEventArgse, wobei es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code führt die folgenden Aktionen aus:
Erstellt eine FontFamily.
Ruft den Namen der Schriftartfamilie ab.
Zeichnet den Namen der Schriftartfamilie als Text auf dem Bildschirm.
Public Sub GetName_Example(ByVal 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
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));
}
public:
void GetName_Example( PaintEventArgs^ e )
{
// Create a FontFamily object.
FontFamily^ myFontFamily = gcnew 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( String::Format( "The family name is {0}", familyName ),
gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) );
}
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.get_Graphics().DrawString("The family name is " + familyName,
new Font(myFontFamily, 16), Brushes.get_Black(),
new PointF(0, 0));
} //GetName_Example
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
FontFamily-Klasse
FontFamily-Member
System.Drawing-Namespace