Bold Property

Font.Bold Property


Gets a value that indicates whether this Font is bold.

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

public bool Bold { get; }

Property Value

Type: System.Boolean

true if this Font is bold; otherwise, false.

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
© 2015 Microsoft