TextDecorationLocation Výčet

Definice

Určuje svislou pozici objektu TextDecoration .

public enum class TextDecorationLocation
public enum TextDecorationLocation
type TextDecorationLocation = 
Public Enum TextDecorationLocation
Dědičnost
TextDecorationLocation

Pole

Baseline 3

Svislá pozice směrného plánu.

OverLine 1

Svislá pozice nadřádu.

Strikethrough 2

Svislá pozice přeškrtnutí.

Underline 0

Svislá pozice podtržení. Toto je výchozí hodnota.

Příklady

Následující příklad vytvoří podtržený text dekorace a použije pro pero plný barevný štětec.

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

Poznámky

Textové dekorace jsou k dispozici ve čtyřech typech: směrný plán, přeškrtnutí, přeškrtnutí a podtržení. Následující příklad ukazuje umístění textových dekorací vzhledem k textu.

Diagram umístění pro dekoraci textu
Typy dekorací textu

Platí pro