Control.FontStretch Control.FontStretch Control.FontStretch Control.FontStretch Property

定義

取得或設定螢幕上字型緊縮或加寬的程度。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. 預設為 NormalThe default is Normal.

範例

下列範例示範如何將控制項的字型自動縮放屬性設定。The following example shows how to set the font stretch property of a control. 如需可能的自動縮放值,請參閱FontStretchesFor 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
若要設定的中繼資料屬性 trueMetadata properties set to true AffectsMeasure, AffectsRender, InheritsAffectsMeasure, AffectsRender, Inherits

適用於