Taal

TextElement.FontStyle Eigenschap

Definitie

Hiermee haalt u de tekenstijl voor de inhoud van het element op of stelt u deze in.

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

Waarde van eigenschap

De gewenste tekenstijl. De standaardwaarde wordt bepaald door de MessageFontStyle waarde.

Voorbeelden

In het volgende voorbeeld ziet u hoe u het kenmerk FontStyle instelt met behulp van Paragraph als voorbeeldelement.

<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>

In de volgende afbeelding ziet u hoe het voorgaande voorbeeld wordt weergegeven.

Schermopname: Tekst met teksteigenschappen instellen

In het volgende voorbeeld ziet u hoe u de eigenschap FontStyle programmatisch instelt.

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

Opmerkingen

Deze afhankelijkheidseigenschap heeft ook een gekoppeld eigenschapsgebruik. In XAML is <object TextElement.FontStyle="value".../>het gebruik, waarbij het object een objectelement is (meestal een stroomelement) dat zich in een TextElement, bevindt en de waarde een van de eigenschapsnamen in tekenreeksindeling in de FontStyles klasse is. In code wordt het gebruik van gekoppelde eigenschappen ondersteund door de GetFontStyle en SetFontStyle methoden. Het gebruik van gekoppelde eigenschappen is niet gebruikelijk, omdat de meeste elementen die kunnen worden opgenomen in een TextElement ondersteuning voor een analoge niet-gekoppelde FontStyle eigenschap, die de inhoudshost gebruikt voor rendering.

Informatie over afhankelijkheidseigenschappen

Item Waarde
Id-veld FontStyleProperty
Eigenschappen van metagegevens ingesteld op true AffectsMeasure, , AffectsRenderInherits

Van toepassing op