FormattedText::SetFontStyle Method (FontStyle, Int32, Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Sets the font style for a specified subset of characters in the FormattedText object.

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

void SetFontStyle(
	FontStyle style,
	int startIndex,
	int count


Type: System.Windows::FontStyle

The FontStyle value to use for text formatting.

Type: System::Int32

The start index of the initial character to apply the font style to.

Type: System::Int32

The number of characters to apply the font style to.

FontStyle supports type conversion behavior such that static values of the FontStyles class can be used to initialize FontStyle and fill parameters that are type FontStyle.

To set the font style for the entire text string, use the SetFontStyle(FontStyle) method.

The following example creates a FormattedText object and then applies several formatting styles to the text, including SetFontStyle.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top