FontStyle 列挙型

定義

テキストに適用するスタイル情報を指定します。

この列挙体は、メンバー値のビットごとの組み合わせをサポートしています。

public enum class FontStyle
[System.Flags]
public enum FontStyle
[<System.Flags>]
type FontStyle = 
Public Enum FontStyle
継承
FontStyle
属性

フィールド

Bold 1

太字テキスト。

Italic 2

斜体テキスト。

Regular 0

標準テキスト。

Strikeout 8

中央に線が引かれているテキスト。

Underline 4

下線付きテキスト。

次のコード例では、 列挙型を Font 使用してボタンの プロパティを新しい太字フォントに設定する方法を FontStyle 示します。 この例は、Windows フォームで使用するように設計されています。 Button1 という名前のボタンを含むフォームを作成し、次のコードを貼り付けます。 メソッドを Button1_Click ボタンの Click イベントに関連付けます。

private:
   void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      Button1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,12.0F,FontStyle::Bold );
   }
private void Button1_Click(System.Object sender, System.EventArgs e)
{
    if (Button1.Font.Style != FontStyle.Bold)
            Button1.Font = new Font(FontFamily.GenericSansSerif,
            12.0F, FontStyle.Bold);
}
 Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    If Not Button1.Font.Style = FontStyle.Bold Then
        Button1.Font = New Font(FontFamily.GenericSansSerif, _
            12.0F, FontStyle.Bold)
    End If
End Sub

適用対象