共用方式為


Font.Bold 屬性

定義

會得到一個值來表示是否 Font 為粗體。

public:
 property bool Bold { bool get(); };
public bool Bold { get; }
member this.Bold : bool
Public ReadOnly Property Bold As Boolean

屬性值

true 若此為 Font 粗體;否則為 false

範例

以下程式碼範例展示了 Inequality 運算子、 Font 建構子及性質 Bold 。 此範例設計用於包含名為 Button2的按鈕的 Windows 表單。 將以下程式碼貼到表單中,並將方法與按鈕事件Click關聯Button2_Click

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

適用於