Control.FontStretch Property


获取或设置字体在屏幕上紧缩或加宽的程度。Gets or sets the degree to which a font is condensed or expanded on the screen.

 property System::Windows::FontStretch FontStretch { System::Windows::FontStretch get(); void set(System::Windows::FontStretch value); };
public System.Windows.FontStretch FontStretch { get; set; }
member this.FontStretch : System.Windows.FontStretch with get, set
Public Property FontStretch As FontStretch

Property Value


一个 FontStretch 值。A FontStretch value. 默认为 NormalThe default is Normal.



下面的示例演示如何设置控件的字体拉伸属性。The following example shows how to set the font stretch property of a control. 有关可能的 stretch 值,请参阅 FontStretchesFor possible stretch values, see FontStretches.

<Button Name="btn10" FontStretch ="Condensed" 
        Click="ChangeFontStretch" TabIndex="3">
void ChangeFontStretch(object sender, RoutedEventArgs e)
    if (btn10.FontStretch == FontStretches.Condensed)
        btn10.FontStretch = FontStretches.Normal;
        btn10.Content = "Control FontStretch changes from Condensed to Normal.";
        btn10.FontStretch = FontStretches.Condensed;
        btn10.Content = "FontStretch";
Private Sub ChangeFontStretch(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    If (btn10.FontStretch = FontStretches.Condensed) Then

        btn10.FontStretch = FontStretches.Normal
        btn10.Content = "Control FontStretch changes from Condensed to Normal."
        btn10.Content = "FontStretch"
        btn10.FontStretch = FontStretches.Condensed
    End If

End Sub


此属性仅影响其模板使用 FontStretch 属性作为参数的控件。This property only affects a control whose template uses the FontStretch property as a parameter. 在其他控件上,此属性不会有任何影响。On other controls, this property has no impact.

依赖项属性信息Dependency Property Information

标识符字段Identifier field FontStretchProperty
元数据属性设置为 trueMetadata properties set to true AffectsMeasureAffectsRenderInheritsAffectsMeasure, AffectsRender, Inherits

Applies to