FontWeights 類別

定義

提供一組預先定義的字型粗細作為靜態屬性值。

public ref class FontWeights sealed
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
class FontWeights final
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
public sealed class FontWeights
Public NotInheritable Class FontWeights
See XAML Syntax for FontWeight
繼承
Object Platform::Object IInspectable FontWeights
屬性

範例

此範例示範如何在 XAML TextBlock上設定 FontWeight 屬性。

<TextBlock Text="FontWeight ExtraBlack" FontWeight="ExtraBlack"/>
TextBlock textBlock1 = new TextBlock();
textBlock1.Text = "FontWeight ExtraBlack";
textBlock1.FontWeight = FontWeights.ExtraBlack;

備註

在標準印刷樣式 API 中,字型的粗細會使用常數名稱來表示,例如「Bold」。 使用常數名稱來設定字型粗細屬性可透過類型轉換器行為以及 FontWeights 支援類別來支援。 針對程式碼存取,相關資訊會以FontWeight值的Weight因數表示。

此影像顯示套用至文字的各種字型粗細值。

套用至文字的各種字型粗細值

屬性

Black

指定字型粗細值 900。

Bold

指定 700 的字型粗細值。

ExtraBlack

指定 950 的字型粗細值。

ExtraBold

指定字型粗細值 800。

ExtraLight

指定 200 的字型粗細值。

Light

指定 300 的字型粗細值。

Medium

指定字型粗細值 500。

Normal

指定字型粗細值 400。

SemiBold

指定 600 的字型粗細值。

SemiLight

指定 350 的字型粗細值。

Thin

指定字型粗細值 100。

適用於