Control.FontStretch Egenskap

Definition

Hämtar eller anger i vilken grad ett teckensnitt komprimeras eller expanderas på skärmen.

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; }
[<System.ComponentModel.Bindable(true)>]
member this.FontStretch : System.Windows.FontStretch with get, set
Public Property FontStretch As FontStretch

Egenskapsvärde

Ett FontStretch värde. Standardvärdet är Normal.

Attribut

Exempel

I följande exempel visas hur du anger egenskapen font stretch för en kontroll. Information om möjliga stretchvärden finns i 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

Kommentarer

Den här egenskapen påverkar bara en kontroll vars mall använder egenskapen FontStretch som en parameter. För andra kontroller har den här egenskapen ingen inverkan.

Information om beroendeegenskap

Item Value
Identifierarfält FontStretchProperty
Metadataegenskaper inställda på true AffectsMeasure, , AffectsRenderInherits

Gäller för