Control.FontStretch 属性
定义
获取或设置字体在屏幕上紧缩或加宽的程度。Gets or sets the degree to which a font is condensed or expanded on the screen.
public:
property System::Windows::FontStretch FontStretch { System::Windows::FontStretch get(); void set(System::Windows::FontStretch value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.FontStretch FontStretch { get; set; }
member this.FontStretch : System.Windows.FontStretch with get, set
Public Property FontStretch As FontStretch
属性值
一个 FontStretch 值。A FontStretch value. 默认值为 Normal。The default is Normal.
- 属性
示例
下面的示例演示如何设置控件的字体拉伸属性。The following example shows how to set the font stretch property of a control. 有关可能的 stretch 值, FontStretches请参阅。For possible stretch values, see 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";
}
}
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."
Else
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 |
元数据属性设置为true Metadata properties set to true |
AffectsMeasure, AffectsRender, InheritsAffectsMeasure, AffectsRender, Inherits |