Font.Bold Font.Bold Font.Bold Font.Bold Property

定義

この Font が太字かどうかを示す値を取得します。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

プロパティ値

この Font が太字の場合は true。それ以外の場合は falsetrue if this Font is bold; otherwise, false.

コード例を次に示します、 Inequality 、演算子、Fontコンス トラクター、およびBoldプロパティ。The following code example demonstrates the Inequality operator, the Font constructor, and the Bold property. この例のという名前のボタンを含む Windows フォームで使用する目的はButton2します。This example is designed to be used with a Windows Form that contains a button named Button2. フォームに次のコードを貼り付け、Button2_Clickメソッドで、ボタンのClickイベント。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

適用対象