ToString Method

FontFamily.ToString Method ()

 

Converts this FontFamily to a human-readable string representation.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public override string ToString()

Return Value

Type: System.String

The string that represents this FontFamily.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code creates a FontFamily and draws a string representation of the font family to the screen.

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));
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft