Control.FontStyle Propriété
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit le style de la police.
public:
property System::Windows::FontStyle FontStyle { System::Windows::FontStyle get(); void set(System::Windows::FontStyle value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.FontStyle FontStyle { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.FontStyle : System.Windows.FontStyle with get, set
Public Property FontStyle As FontStyle
Valeur FontStyle. La valeur par défaut est Normal.
- Attributs
L’exemple suivant montre comment définir la propriété de style de police d’un contrôle.
<Button Name="btn4" FontStyle="Normal"
Click="ChangeFontStyle">
FontStyle
</Button>
void ChangeFontStyle(object sender, RoutedEventArgs e)
{
if (btn4.FontStyle == FontStyles.Italic)
{
btn4.FontStyle = FontStyles.Normal;
btn4.Content = "FontStyle";
}
else
{
btn4.FontStyle = FontStyles.Italic;
btn4.Content = "Control font style changes from Normal to Italic.";
}
}
Private Sub ChangeFontStyle(ByVal Sender As Object, ByVal e As RoutedEventArgs)
If (btn4.FontStyle = FontStyles.Italic) Then
btn4.FontStyle = FontStyles.Normal
btn4.Content = "FontStyle"
Else
btn4.FontStyle = FontStyles.Italic
btn4.Content = "Control font style changes from Normal to Italic."
End If
End Sub
Cette propriété affecte uniquement un contrôle dont le modèle utilise la FontStyle propriété comme paramètre. Sur les autres contrôles, cette propriété n’a aucun impact.
Champ Identificateur | FontStyleProperty |
Propriétés de métadonnées définies sur true |
AffectsMeasure, AffectsRender, Inherits |
Produit | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Commentaires sur .NET
.NET est un projet open source. Sélectionnez un lien pour fournir des commentaires: