TextDecorationLocation Enumeration
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Gibt die vertikale Position eines TextDecoration-Objekts an.
public enum class TextDecorationLocation
public enum TextDecorationLocation
type TextDecorationLocation =
Public Enum TextDecorationLocation
- Vererbung
Felder
| Name | Wert | Beschreibung |
|---|---|---|
| Underline | 0 | Die vertikale Position einer Unterstreichung. Dies ist der Standardwert. |
| OverLine | 1 | Die vertikale Position einer Überlinie. |
| Strikethrough | 2 | Die vertikale Position einer durchgestrichenen Vorgehensweise. |
| Baseline | 3 | Die vertikale Position eines Basisplans. |
Beispiele
Im folgenden Beispiel wird eine Textunterstreichung erstellt und ein Pinsel mit Volltonfarbe für den Stift verwendet.
// 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>
Hinweise
Text-Dekorationen sind in vier Typen verfügbar: Basislinie, Überstreichung, Durchstreichung und Unterstreichung. Das folgende Beispiel zeigt die Positionen der Textdeko relativ zum Text.
Text-Dekorationstypen