TextElement.FontStyle Propriété
Définition
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 police pour le contenu de l’élément.
public:
property System::Windows::FontStyle FontStyle { System::Windows::FontStyle get(); void set(System::Windows::FontStyle value); };
public System.Windows.FontStyle FontStyle { get; set; }
member this.FontStyle : System.Windows.FontStyle with get, set
Public Property FontStyle As FontStyle
Valeur de propriété
Style de police souhaité. La valeur par défaut est déterminée par la MessageFontStyle valeur.
Exemples
L’exemple suivant montre comment définir l’attribut FontStyle , à l’aide Paragraph de l’exemple d’élément.
<Paragraph
FontFamily="Century Gothic, Courier New"
FontSize="16pt"
FontStretch="UltraExpanded"
FontStyle="Italic"
FontWeight="DemiBold"
>
<Run>
This text will use the Century Gothic font (if available), with fallback to Courier New. It
will render with a font size of 16 points in ultra-expanded demi-bold italic.
</Run>
</Paragraph>
La figure suivante montre comment l’exemple précédent s’affiche.
L’exemple suivant montre comment définir la FontStyle propriété par programmation.
Run run = new Run(
"This text will use the Century Gothic font (if available), with fallback to Courier New."
+ "It will render with a font size of 16 pixels in ultra-expanded demi-bold italic.");
Paragraph par = new Paragraph(run);
par.FontFamily = new FontFamily("Century Gothic, Courier New");
par.FontSize = 16;
par.FontStretch = FontStretches.UltraExpanded;
par.FontStyle = FontStyles.Italic;
par.FontWeight = FontWeights.DemiBold;
Dim run As New Run("This text will use the Century Gothic font (if available), with fallback to Courier New." & "It will render with a font size of 16 pixels in ultra-expanded demi-bold italic.")
Dim par As New Paragraph(run)
With par
.FontFamily = New FontFamily("Century Gothic, Courier New")
.FontSize = 16
.FontStretch = FontStretches.UltraExpanded
.FontStyle = FontStyles.Italic
.FontWeight = FontWeights.DemiBold
End With
Remarques
Cette propriété de dépendance a également une utilisation des propriétés jointes. En XAML, l’utilisation est <object TextElement.FontStyle="value".../>, où l’objet est un élément d’objet (généralement un élément de flux) contenu dans un TextElement, et la valeur est l’un des noms de propriétés au format chaîne dans la FontStyles classe. Dans le code, l’utilisation des propriétés jointes est prise en charge par les méthodes et SetFontStyle les GetFontStyle méthodes. L’utilisation des propriétés jointes n’est pas courante, car la plupart des éléments pouvant être contenus dans une TextElement propriété de prise en charge non attachée FontStyle , utilisée par l’hôte de contenu pour le rendu.
Informations sur les propriétés de dépendance
| Élément | Valeur |
|---|---|
| Champ d’identificateur | FontStyleProperty |
Propriétés de métadonnées définies sur true |
AffectsMeasure, , AffectsRenderInherits |