Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Font.Bold Property
Definition
- Namespace:
- System.Drawing
- Assembly:
- System.Drawing.Common.dll
- Assembly:
- System.Drawing.dll
- Package:
- System.Drawing.Common v11.0.0-preview.5.26302.115
- Source:
- Font.cs
- Source:
- Font.cs
- Source:
- Font.cs
- Source:
- Font.cs
- Source:
- Font.cs
- Source:
- Font.cs
- Source:
- Font.cs
- Source:
- Font.cs
- Source:
- Font.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that indicates whether this Font is bold.
public:
property bool Bold { bool get(); };
public bool Bold { get; }
member this.Bold : bool
Public ReadOnly Property Bold As Boolean
Property Value
true if this Font is bold; otherwise, false.
Examples
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.
void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
if ( this->BackColor != SystemColors::ControlDark )
{
this->BackColor = SystemColors::ControlDark;
}
if ( !(this->Font->Bold) )
{
this->Font = gcnew System::Drawing::Font( this->Font,FontStyle::Bold );
}
}
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 Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
If (Color.op_Inequality(Me.BackColor, SystemColors.ControlDark)) Then
Me.BackColor = SystemColors.ControlDark
End If
If Not (Me.Font.Bold) Then
Me.Font = New Font(Me.Font, FontStyle.Bold)
End If
End Sub
Applies to
Feedback
Was this page helpful?
