Font.Style プロパティ
アセンブリ: System.Drawing (system.drawing.dll 内)


FontStyle 列挙体を使用して、ボタンの Font プロパティを新しい太字のフォントに設定する方法を次のコード例に示します。この例は、Windows フォームでの使用を意図してデザインされています。Button1 という名前のボタンを含むフォームを作成し、このフォームに次のコードを貼り付けます。ボタンの Click イベントに Button1_Click メソッドを関連付けます。
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
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); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


FontStyle 列挙体
この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。
名前空間: System.Drawingアセンブリ: System.Drawing (system.drawing.dll 内)

<FlagsAttribute> _ Public Enumeration FontStyle


FontStyle 列挙体を使用して、ボタンの Font プロパティを新しい太字スタイル フォントに設定する方法を次のコード例に示します。この例は、Windows フォームでの使用を意図してデザインされています。Button1 という名前のボタンを含んだフォームを作成し、このフォームに次のコードを貼り付けます。ボタンの Click イベントに Button1_Click メソッドを関連付けます。
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
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); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- font-styleのページへのリンク