Control.FontWeight Właściwość

Definicja

Pobiera lub ustawia wagę lub grubość określonej czcionki.

public:
 property System::Windows::FontWeight FontWeight { System::Windows::FontWeight get(); void set(System::Windows::FontWeight value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.FontWeight FontWeight { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.FontWeight : System.Windows.FontWeight with get, set
Public Property FontWeight As FontWeight

Wartość właściwości

FontWeight

FontWeight Wartość. Wartość domyślna to Normal.

Atrybuty

Przykłady

W poniższym przykładzie pokazano, jak ustawić FontWeight właściwość kontrolki.

<Button Name="btn5" FontWeight="Normal" 
        Click="ChangeFontWeight">
  FontWeight
</Button>
void ChangeFontWeight(object sender, RoutedEventArgs e)
{
    if (btn5.FontWeight == FontWeights.Bold)
    {
        btn5.FontWeight = FontWeights.Normal;
        btn5.Content = "FontWeight";
    }
    else
    {
        btn5.FontWeight = FontWeights.Bold;
        btn5.Content = "Control font weight changes from Normal to Bold.";
    }
}
Private Sub ChangeFontWeight(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    If (btn5.FontWeight = FontWeights.Bold) Then

        btn5.FontWeight = FontWeights.Normal
        btn5.Content = "FontWeight"

    Else

        btn5.FontWeight = FontWeights.Bold
        btn5.Content = "Control font weight changes from Normal to Bold."
    End If
End Sub

Uwagi

Ta właściwość ma wpływ tylko na kontrolkę, której szablon używa FontWeight właściwości jako parametru. Ta właściwość nie ma wpływu na inne kontrolki. Aby uzyskać listę wstępnie zdefiniowanych FontWeight wartości, zobacz klasę FontWeights .

Informacje dotyczące właściwości zależności

Pole identyfikatora FontWeightProperty
Właściwości metadanych ustawione na true AffectsMeasure, AffectsRender, Inherits

Dotyczy