次の方法で共有


FontFamily.GetName メソッド

この FontFamily オブジェクトの名前を指定の言語で返します。

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

パラメータ

  • language
    返される名前の言語。

戻り値

この FontFamily オブジェクトの名前を指定の言語で表す String オブジェクト。 FontFamily オブジェクトを作成し、そのフォント ファミリの名前を取得してから、その名前をテキストで画面に描画します。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • FontFamily オブジェクトを作成します。
  • フォント ファミリの名前を取得します。
  • フォント ファミリの名前をテキストで画面に描画します。
 
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] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

FontFamily クラス | FontFamily メンバ | System.Drawing 名前空間