FontWeight 結構

定義

是指字樣密度,就筆劃的光度或重度而言。

public value class FontWeight : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.FontWeightConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None)]
public struct FontWeight : IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.FontWeightConverter))>]
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None)>]
type FontWeight = struct
    interface IFormattable
Public Structure FontWeight
Implements IFormattable
繼承
FontWeight
屬性
實作

範例

以下程式碼範例中,將 FontWeight 設定為「UltraBold」。

<TextBlock FontWeight="UltraBold" FontFamily="Gil Sans MT">Hello, world</TextBlock>

備註

粗細差異通常透過字體中某個字元所對應的筆劃或粗細來區分,相較於同一字體的「正常」字元。

並非所有字體都有字粗。 當字體無法提供字重時,會回傳最接近的字重。

XAML 屬性使用方式

<object fontWeightProperty="fontWeightsValue"/>

XAML 值

fontWeightsValue 屬性 FontWeights 名稱,例如「Light」、「Normal」或「UltraBold」。

方法

名稱 Description
Compare(FontWeight, FontWeight)

比較兩個 的 FontWeight實例。

Equals(FontWeight)

判斷當前 FontWeight 物件是否等於指定 FontWeight 物件。

Equals(Object)

判斷當前 FontWeight 物件是否等於指定物件。

FromOpenTypeWeight(Int32)

建立一個對應 OpenType FontWeight 值的新實例usWeightClass

GetHashCode()

取得此物件的雜湊碼。

ToOpenTypeWeight()

回傳一個代表該usWeightClass物件 OpenType FontWeight 的值。

ToString()

回傳一個文字字串,代表物件的值 FontWeight ,並基於 CurrentCulture 屬性資訊。

操作員

名稱 Description
Equality(FontWeight, FontWeight)

比較兩個 的 FontWeight 實例,為相等。

GreaterThan(FontWeight, FontWeight)

評估兩個實 FontWeight 例,以判斷其中一個實例是否優於另一實例。

GreaterThanOrEqual(FontWeight, FontWeight)

評估兩個 的 FontWeight 實例,以判斷其中一個實例是否大於或等於另一個。

Inequality(FontWeight, FontWeight)

評估兩個案例 FontWeight 以判定不平等。

LessThan(FontWeight, FontWeight)

評估兩個實 FontWeight 例,以判斷其中一個實例是否小於另一實例。

LessThanOrEqual(FontWeight, FontWeight)

評估兩個實 FontWeight 例,以判斷其中一個實例大小或相等於另一個實例。

明確介面實作

名稱 Description
IFormattable.ToString(String, IFormatProvider)

關於此成員的描述,請參見 ToString(String, IFormatProvider)

適用於

另請參閱