TextDecorationLocation Enumeration
.NET Framework 3.0
Specifies the vertical position of a TextDecoration object.
Namespace: System.Windows
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
The following example creates an underline text decoration and uses a solid color brush for the pen.
<!-- Use a Red pen for the underline text decoration --> <TextBlock FontSize="36" > jumped over <TextBlock.TextDecorations> <TextDecorationCollection> <TextDecoration PenThicknessUnit="FontRecommended"> <TextDecoration.Pen> <Pen Brush="Red" Thickness="1" /> </TextDecoration.Pen> </TextDecoration> </TextDecorationCollection> </TextBlock.TextDecorations> </TextBlock>
// Use a Red pen for the underline text decoration. private void SetRedUnderline() { // Create an underline text decoration. Default is underline. TextDecoration myUnderline = new TextDecoration(); // Create a solid color brush pen for the text decoration. myUnderline.Pen = new Pen(Brushes.Red, 1); myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended; // Set the underline decoration to a TextDecorationCollection and add it to the text block. TextDecorationCollection myCollection = new TextDecorationCollection(); myCollection.Add(myUnderline); TextBlock2.TextDecorations = myCollection; }
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: