次の方法で共有


FontFamily.ToString メソッド

この FontFamily オブジェクトをユーザーが判読できる文字列形式に変換します。

Overrides Public Function ToString() As String
[C#]
public override string ToString();
[C++]
public: String* ToString();
[JScript]
public override function ToString() : String;

戻り値

この FontFamily オブジェクトを表す文字列。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードでは、 FontFamily オブジェクトを作成し、フォント ファミリの文字列形式を画面に描画します。

 
Public Sub ToString_Example(e As PaintEventArgs)
' Create a FontFamily object.
Dim myFontFamily As New FontFamily("Arial")
' Draw a string representation of myFontFamily to the screen.
e.Graphics.DrawString(myFontFamily.ToString(), _
New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub
        
[C#] 
public void ToString_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily myFontFamily = new FontFamily("Arial");
// Draw a string representation of myFontFamily to the screen.
e.Graphics.DrawString(
myFontFamily.ToString(),
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 ファミリ, .NET Compact Framework - Windows CE .NET

参照

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