Font.Style プロパティ

定義

この Fontのスタイル情報を取得します。

public:
 property System::Drawing::FontStyle Style { System::Drawing::FontStyle get(); };
[System.ComponentModel.Browsable(false)]
public System.Drawing.FontStyle Style { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Style : System.Drawing.FontStyle
Public ReadOnly Property Style As FontStyle

プロパティ値

このFontStyleのスタイル情報を含むFont列挙体。

属性

次のコード例では、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

適用対象