FontWeight 結構

定義

以筆劃輕重表示字樣密度。Refers to the density of a typeface, in terms of the lightness or heaviness of the strokes.

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

範例

在下列FontWeight程式碼範例中, 會設定為 "UltraBold"。In the following code example, the FontWeight is set to "UltraBold".

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

備註

權數差異通常會藉由增加的筆劃或粗細 (與字樣中的指定字元相關聯) 來區別, 相較于相同的字樣中的「一般」字元。Weight differences are generally differentiated by an increased stroke or thickness that is associated with a given character in a typeface, as compared to a "normal" character from that same typeface.

注意並非所有的權數都適用于所有字樣。Note Not all weights are available for all typefaces. 當權數無法用於字樣時, 會傳回最接近的相符權數。When a weight is not available for a typeface, the closest matching weight is returned.

XAML Attribute UsageXAML Attribute Usage

<object fontWeightProperty="fontWeightsValue"/>  

XAML 值XAML Values

fontWeightsValuefontWeightsValue
FontWeights屬性名稱, 例如 "Light"、"Normal" 或 "UltraBold"。A FontWeights property name, such as "Light", "Normal", or "UltraBold".

方法

Compare(FontWeight, FontWeight)

比較兩個 FontWeight 執行個體。Compares two instances of FontWeight.

Equals(FontWeight)

判斷目前的 FontWeight 物件是否等於指定的 FontWeight 物件。Determines whether the current FontWeight object is equal to a specified FontWeight object.

Equals(Object)

判斷目前的 FontWeight 物件是否等於指定的物件。Determines whether the current FontWeight object is equal to a specified object.

FromOpenTypeWeight(Int32)

建立對應於 OpenTypeOpenType usWeightClass 值的新 FontWeight 執行個體。Creates a new instance of FontWeight that corresponds to the OpenTypeOpenType usWeightClass value.

GetHashCode()

擷取這個物件的雜湊碼。Retrieves the hash code for this object.

ToOpenTypeWeight()

針對 FontWeight 物件傳回代表 OpenTypeOpenType usWeightClass 的值。Returns a value that represents the OpenTypeOpenType usWeightClass for the FontWeight object.

ToString()

傳回表示 FontWeight 的物件值,且以 CurrentCulture 屬性資訊為基礎的文字字串。Returns a text string that represents the value of the FontWeight object and is based on the CurrentCulture property information.

運算子

Equality(FontWeight, FontWeight)

比較 FontWeight 的兩個執行個體是否相等。Compares two instances of FontWeight for equality.

GreaterThan(FontWeight, FontWeight)

評估 FontWeight 的兩個執行個體,判斷其中一個執行個體是否大於另一個。Evaluates two instances of FontWeight to determine whether one instance is greater than the other.

GreaterThanOrEqual(FontWeight, FontWeight)

評估 FontWeight 的兩個執行個體,判斷其中一個執行個體是否大於或等於另一個。Evaluates two instances of FontWeight to determine whether one instance is greater than or equal to the other.

Inequality(FontWeight, FontWeight)

評估 FontWeight 的兩個執行個體,判斷兩者是否不相等。Evaluates two instances of FontWeight to determine inequality.

LessThan(FontWeight, FontWeight)

評估 FontWeight 的兩個執行個體,判斷其中一個執行個體是否小於另一個。Evaluates two instances of FontWeight to determine whether one instance is less than the other.

LessThanOrEqual(FontWeight, FontWeight)

評估 FontWeight 的兩個執行個體,判斷其中一個執行個體是否小於或等於另一個。Evaluates two instances of FontWeight to determine whether one instance is less than or equal to the other.

明確介面實作

IFormattable.ToString(String, IFormatProvider)

如需這個成員的說明,請參閱 ToString(String, IFormatProvider)For a description of this member, see ToString(String, IFormatProvider).

適用於

另請參閱