TextDecoration Constructor (TextDecorationLocation, Pen^, Double, TextDecorationUnit, TextDecorationUnit)

 

Initializes a new instance of the TextDecoration class with the specified Location, Pen, PenOffset, PenOffsetUnit, and PenThicknessUnit values.

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

public:
TextDecoration(
	TextDecorationLocation location,
	Pen^ pen,
	double penOffset,
	TextDecorationUnit penOffsetUnit,
	TextDecorationUnit penThicknessUnit
)

Parameters

location
Type: System.Windows::TextDecorationLocation

The location of the text decoration.

pen
Type: System.Windows.Media::Pen^

The Pen used to draw the text decoration. If this value is null, the text decoration color matches the text color to which it is applied, and the text decoration's thickness is set to the font's recommended thickness.

penOffset
Type: System::Double

The vertical displacement from the text decoration's location. A negative value moves the decoration lower, while a positive value moves the decoration higher.

penOffsetUnit
Type: System.Windows::TextDecorationUnit

The units used to interpret the value of penOffset.

penThicknessUnit
Type: System.Windows::TextDecorationUnit

The units used to interpret the value of the Thickness for the pen.

The following code example shows how to create a TextDecoration by using the location, pen, penOffset, penOffsetUnit, and penThicknessUnit parameters.

No code example is currently available or this language may not be supported.
<TextBlock>
  <TextBlock.TextDecorations>
    <TextDecoration Location="Baseline" PenOffset="2" PenOffsetUnit="Pixel" PenThicknessUnit="Pixel" >
      <TextDecoration.Pen>
        <Pen Brush="Maroon" Thickness="1" />
      </TextDecoration.Pen>
    </TextDecoration>
  </TextBlock.TextDecorations>
  The quick red fox
</TextBlock>

.NET Framework
Available since 3.0
Return to top
Show: