TextDecorationLocation 列挙型

定義

TextDecoration オブジェクトの垂直方向の位置を指定します。

public enum class TextDecorationLocation
public enum TextDecorationLocation
type TextDecorationLocation = 
Public Enum TextDecorationLocation
継承
TextDecorationLocation

フィールド

名前 説明
Underline 0

下線の垂直方向の位置。 これが既定値です。

OverLine 1

オーバーラインの垂直方向の位置。

Strikethrough 2

取り消し線の垂直方向の位置。

Baseline 3

ベースラインの垂直方向の位置。

次の使用例は、下線のテキスト装飾を作成し、ペンに単色ブラシを使用します。

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

注釈

テキスト装飾は、ベースライン、オーバーライン、取り消し線、下線の 4 種類で使用できます。 次の例は、テキストに対するテキスト装飾の位置を示しています。

テキスト装飾の場所の
テキスト装飾の種類

適用対象