FontStyle FontStyle FontStyle FontStyle Struct

定义

定义表示常规、斜体或倾斜字体样式的结构。Defines a structure that represents the style of a font face as normal, italic, or oblique.

public value class FontStyle : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.FontStyleConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None)]
public struct FontStyle : IFormattable
type FontStyle = struct
    interface IFormattable
Public Structure FontStyle
Implements IFormattable
继承
属性
实现

示例

下面的示例将"Italic"设置FontStyle为。The following example sets "Italic" as the FontStyle.

<TextBlock FontStyle="Italic">Italic font style</TextBlock>

注解

以下三个术语对字体的斜面进行分类: normal、斜体和倾斜。Three terms categorize the slant of a font: normal, italic, and oblique.

字体样式Font style 说明Description
普通Normal 正常或罗马字体中的字符是直立的。The characters in a normal, or roman, font are upright.
斜体Italic 斜体字体中的字符确实倾斜, 并按设计方式出现。The characters in an italic font are truly slanted and appear as they were designed.
倾斜Oblique 倾斜字体中的字符以人为倾斜。The characters in an oblique font are artificially slanted. 通过对普通字体中的字符执行切变变换来实现倾斜度。The slant is achieved by performing a shear transformation on the characters from a normal font. 如果计算机或打印机上没有真正的斜体字体, 则可以使用普通字体生成倾斜样式, 并使用它来模拟斜体字体。When a true italic font is not available on a computer or printer, an oblique style can generated from the normal font and used to simulate an italic font.

您可以使用FontStyles类的枚举值FontStyle设置结构。You can use the enumerated values of the FontStyles class to set the FontStyle structure.

XAML 属性用法XAML Attribute Usage

<object fontStyleProperty="fontStylesValue"/>  

XAML 值XAML Values

fontStylesValuefontStylesValue
FontStyles值, 如 "Normal"、"斜体" 或 "倾斜"。A FontStyles value, such as "Normal", "Italic", or "Oblique".

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

比较 Object 与当前的 FontStyle 实例是否相等。Compares an Object with the current FontStyle instance for equality.

Equals(FontStyle) Equals(FontStyle) Equals(FontStyle) Equals(FontStyle)

比较 FontStyle 与当前的 FontStyle 实例是否相等。Compares a FontStyle with the current FontStyle instance for equality.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

检索此对象的哈希代码。Retrieves the hash code for this object.

ToString() ToString() ToString() ToString()

创建一个 String,它表示当前 FontStyle 对象,并基于 CurrentCulture 属性信息。Creates a String that represents the current FontStyle object and is based on the CurrentCulture property information.

操作员

Equality(FontStyle, FontStyle) Equality(FontStyle, FontStyle) Equality(FontStyle, FontStyle) Equality(FontStyle, FontStyle)

比较 FontStyle 的两个实例是否相等。Compares two instances of FontStyle for equality.

Inequality(FontStyle, FontStyle) Inequality(FontStyle, FontStyle) Inequality(FontStyle, FontStyle) Inequality(FontStyle, FontStyle)

FontStyle 的两个实例进行评估,以确定它们是否不相等。Evaluates two instances of FontStyle to determine inequality.

显式界面实现

IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider)

有关此成员的说明,请参见 ToString(String, IFormatProvider)For a description of this member, see ToString(String, IFormatProvider).

适用于

另请参阅