Font Constructor (Font, FontStyle)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Initializes a new Font that uses the specified existing Font and FontStyle enumeration.

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

public Font(
	Font prototype,
	FontStyle newStyle


Type: System.Drawing.Font

The existing Font from which to create the new Font.

Type: System.Drawing.FontStyle

The FontStyle to apply to the new Font. Multiple values of the FontStyle enumeration can be combined with the OR operator.

For localized applications that are based on the .NET Framework 2.0 and earlier releases, specifying a font for prototype when that font has not been installed on the computer that is used to build your application will cause the Microsoft Sans Serif font to be used instead. If your application depends on this behavior and you must recompile your application for the .NET Framework 3.0, you should specify the Microsoft Sans Serif font for prototype.

The following code example demonstrates the Inequality operator, the Font constructor, and the Bold property. This example is designed to be used with a Windows Form that contains a button named Button2. Paste the following code into your form and associate the Button2_Click method with the button's Click event.

private void Button2_Click(System.Object sender, System.EventArgs e)

    if (this.BackColor != SystemColors.ControlDark)
        this.BackColor = SystemColors.ControlDark;
    if (!(this.Font.Bold))
        this.Font = new Font(this.Font, FontStyle.Bold);

.NET Framework
Available since 1.1
Return to top