使用英语阅读

通过


Control.FontStretch 属性

定义

获取或设置字体在屏幕上紧缩或加宽的程度。

[System.ComponentModel.Bindable(true)]
public System.Windows.FontStretch FontStretch { get; set; }

属性值

一个 FontStretch 值。 默认值为 Normal

属性

示例

以下示例演示如何设置控件的字体拉伸属性。 有关可能的拉伸值,请参阅 FontStretches

<Button Name="btn10" FontStretch ="Condensed" 
        Click="ChangeFontStretch" TabIndex="3">
  FontStretch
</Button>
void ChangeFontStretch(object sender, RoutedEventArgs e)
{
    if (btn10.FontStretch == FontStretches.Condensed)
    {
        btn10.FontStretch = FontStretches.Normal;
        btn10.Content = "Control FontStretch changes from Condensed to Normal.";
    }
    else
    {
        btn10.FontStretch = FontStretches.Condensed;
        btn10.Content = "FontStretch";
    }
}

注解

此属性仅影响其模板使用 FontStretch 属性作为参数的控件。 在其他控件上,此属性没有影响。

依赖项属性信息

标识符字段 FontStretchProperty
元数据属性设置为 true AffectsMeasure, AffectsRender, Inherits

适用于