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

適用対象