TextDecorationLocation Enum

Definitie

Hiermee geeft u de verticale positie van een TextDecoration object.

public enum class TextDecorationLocation
public enum TextDecorationLocation
type TextDecorationLocation = 
Public Enum TextDecorationLocation
Overname
TextDecorationLocation

Velden

Name Waarde Description
Underline 0

De verticale positie van een onderstreping. Dit is de standaardwaarde.

OverLine 1

De verticale positie van een overlijn.

Strikethrough 2

De verticale positie van een doorhaling.

Baseline 3

De verticale positie van een basislijn.

Voorbeelden

In het volgende voorbeeld wordt een onderstrepingstekstdecoratie gemaakt en wordt een effen kleurborstel gebruikt voor de pen.

// 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;
}
' Use a Red pen for the underline text decoration.
Private Sub SetRedUnderline()
    ' Create an underline text decoration. Default is underline.
    Dim myUnderline As 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.
    Dim myCollection As New TextDecorationCollection()
    myCollection.Add(myUnderline)
    TextBlock2.TextDecorations = myCollection
End Sub
<!-- Use a Red pen for the underline text decoration -->
<TextBlock
  FontSize="36" >
  jumps over
  <TextBlock.TextDecorations>
    <TextDecorationCollection>
      <TextDecoration 
        PenThicknessUnit="FontRecommended">
        <TextDecoration.Pen>
          <Pen Brush="Red" Thickness="1" />
        </TextDecoration.Pen>
      </TextDecoration>
    </TextDecorationCollection>
  </TextBlock.TextDecorations>
</TextBlock>

Opmerkingen

Tekstdecoraties zijn beschikbaar in vier typen: basislijn, overlijn, doorhalen en onderstrepen. In het volgende voorbeeld ziet u de locaties van de tekstdecoraties ten opzichte van de tekst.

Diagram van tekstversieringslocaties Diagram van
Typen tekstdecoratie

Van toepassing op