Export (0) Print
Expand All

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 */
public boolean get_Bold ()

public function get Bold () : boolean

Not applicable.

Property Value

true if this Font is bold; otherwise, false.

The following code example demonstrates the op_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);
    }
}

private void button2_Click(System.Object sender, System.EventArgs e)
{
    if (!(this.get_BackColor().Equals(SystemColors.get_ControlDark()))) {
        this.set_BackColor(SystemColors.get_ControlDark());
    }
    if (!(this.get_Font().get_Bold())) {
        this.set_Font(new Font(this.get_Font(), FontStyle.Bold));
    }
} //button2_Click

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft