TextDecoration TextDecoration TextDecoration TextDecoration Constructors

定義

オーバーロード

TextDecoration() TextDecoration() TextDecoration()

TextDecoration クラスの新しいインスタンスを初期化します。Initializes a new instance of the TextDecoration class.

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

TextDecorationLocationPenPenOffsetPenOffsetUnit のそれぞれの値を指定して、PenThicknessUnit クラスの新しいインスタンスを初期化します。Initializes a new instance of the TextDecoration class with the specified Location, Pen, PenOffset, PenOffsetUnit, and PenThicknessUnit values.

TextDecoration() TextDecoration() TextDecoration()

TextDecoration クラスの新しいインスタンスを初期化します。Initializes a new instance of the TextDecoration class.

public:
 TextDecoration();
public TextDecoration ();
Public Sub New ()

次のコード例は、パラメーターなしのTextDecorationコンストラクターを使用してを作成する方法を示しています。The following code example shows how to create a TextDecoration using the parameterless constructor.

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

注釈

Locationプロパティの既定値はUnderlineです。The default value of the Location property is Underline.

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

TextDecorationLocationPenPenOffsetPenOffsetUnit のそれぞれの値を指定して、PenThicknessUnit クラスの新しいインスタンスを初期化します。Initializes a new instance of the TextDecoration class with the specified Location, Pen, PenOffset, PenOffsetUnit, and PenThicknessUnit values.

public:
 TextDecoration(System::Windows::TextDecorationLocation location, System::Windows::Media::Pen ^ pen, double penOffset, System::Windows::TextDecorationUnit penOffsetUnit, System::Windows::TextDecorationUnit penThicknessUnit);
public TextDecoration (System.Windows.TextDecorationLocation location, System.Windows.Media.Pen pen, double penOffset, System.Windows.TextDecorationUnit penOffsetUnit, System.Windows.TextDecorationUnit penThicknessUnit);
new System.Windows.TextDecoration : System.Windows.TextDecorationLocation * System.Windows.Media.Pen * double * System.Windows.TextDecorationUnit * System.Windows.TextDecorationUnit -> System.Windows.TextDecoration

パラメーター

location
TextDecorationLocation TextDecorationLocation TextDecorationLocation TextDecorationLocation

文字装飾の位置。The location of the text decoration.

pen
Pen Pen Pen Pen

文字装飾の描画に使用される PenThe Pen used to draw the text decoration. この値が null の場合、文字装飾の色が適用対象のテキストの色に一致し、文字装飾の太さがフォントで推奨されている太さに設定されます。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
Double Double Double 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
TextDecorationUnit TextDecorationUnit TextDecorationUnit TextDecorationUnit

penOffset の値を解釈するために使用される単位。The units used to interpret the value of penOffset.

penThicknessUnit
TextDecorationUnit TextDecorationUnit TextDecorationUnit TextDecorationUnit

penThickness の値を解釈するために使用される単位。The units used to interpret the value of the Thickness for the pen.

TextDecorationpenOffsetlocation 、およびpenThicknessUnitの各パラメーターを使用penしてを作成する方法を次のコード例に示します。 penOffsetUnitThe following code example shows how to create a TextDecoration by using the location, pen, penOffset, penOffsetUnit, and penThicknessUnit parameters.

// Use a Maroon pen for the baseline text decoration.
private void SetMaroonBaseline()
{
    // Create an baseline text decoration 2 units lower than the default.
    TextDecoration myBaseline = new TextDecoration(
            TextDecorationLocation.Baseline,
            new Pen(Brushes.Maroon, 1),
            2.0,
            TextDecorationUnit.Pixel,
            TextDecorationUnit.Pixel);

    // Set the baseline decoration to a TextDecorationCollection and add it to the text block.
    TextDecorationCollection myCollection = new TextDecorationCollection();
    myCollection.Add(myBaseline);
    TextBlock2.TextDecorations = myCollection;
}
' Use a Maroon pen for the baseline text decoration.
Private Sub SetMaroonBaseline()
    ' Create an baseline text decoration 2 units lower than the default.
    Dim myBaseline As New TextDecoration(TextDecorationLocation.Baseline, New Pen(Brushes.Maroon, 1), 2.0, TextDecorationUnit.Pixel, TextDecorationUnit.Pixel)

    ' Set the baseline decoration to a TextDecorationCollection and add it to the text block.
    Dim myCollection As New TextDecorationCollection()
    myCollection.Add(myBaseline)
    TextBlock2.TextDecorations = myCollection
End Sub
<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>

適用対象