TextDecorationLocation Enumeração
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Especifica a posição vertical de um TextDecoration objeto.
public enum class TextDecorationLocation
public enum TextDecorationLocation
type TextDecorationLocation =
Public Enum TextDecorationLocation
- Herança
Campos
| Name | Valor | Description |
|---|---|---|
| Underline | 0 | A posição vertical de um sublinhado. Este é o valor padrão. |
| OverLine | 1 | A posição vertical de uma overline. |
| Strikethrough | 2 | A posição vertical de um strikethrough. |
| Baseline | 3 | A posição vertical de uma linha de base. |
Exemplos
O exemplo seguinte cria uma decoração de texto sublinhado e utiliza um pincel de cor sólida para a caneta.
// 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>
Observações
As decorações de texto estão disponíveis em quatro tipos: base, overline, riscado e sublinhado. O exemplo seguinte mostra as localizações das decorações do texto em relação ao texto.
Tipos de decoração de texto