FontStyle 列舉

定義

指定套用至文字的樣式資訊。

此列舉支援其成員值的位元組合。

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

欄位

名稱 Description
Regular 0

正常的文字。

Bold 1

粗體字。

Italic 2

斜體文字。

Underline 4

有底線文字。

Strikeout 8

中間有條線的文字。

範例

以下程式碼範例示範如何 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

適用於