TextDecorations 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
정적 미리 정의된 텍스트 장식 집합을 제공합니다.
public ref class TextDecorations abstract sealed
public static class TextDecorations
type TextDecorations = class
Public Class TextDecorations
- 상속
-
TextDecorations
예제
다음 예제에서 취소선 텍스트 장식은 기본 글꼴 값을 사용합니다.
// Use the default font values for the strikethrough text decoration.
private void SetDefaultStrikethrough()
{
// Set the underline decoration directly to the text block.
TextBlock1.TextDecorations = TextDecorations.Strikethrough;
}
' Use the default font values for the strikethrough text decoration.
Private Sub SetDefaultStrikethrough()
' Set the underline decoration directly to the text block.
TextBlock1.TextDecorations = TextDecorations.Strikethrough
End Sub
<!-- Use the default font values for the strikethrough text decoration. -->
<TextBlock
TextDecorations="Strikethrough"
FontSize="36" >
The quick red fox
</TextBlock>
동일한 텍스트에 대해 여러 텍스트 장식을 지정할 수도 있습니다. 다음 예제에서는 동일한 텍스트에 밑줄 및 오버라인 텍스트 장식이 사용됩니다.
<!-- Use both an underline and overline text decoration for the same text. -->
<TextBlock TextDecorations="Underline, Overline">
The quick red fox
</TextBlock>
문자열 값 "None"을 사용하여 컬렉션에 텍스트 장식이 없음을 TextDecorations 나타낼 수 있습니다. 다음 예제에서는 컬렉션이 TextDecorations "None"으로 설정됩니다.
<!-- Set the text decoration collection to None to indicate no decorations. -->
<TextBlock TextDecorations="None">
The quick red fox
</TextBlock>
메서드를 사용하여 텍스트에서 모든 텍스트 장식을 Clear 제거할 수 있습니다. 다음 예제에서는 컬렉션이 TextDecorations 지워집니다.
TextBlock2.TextDecorations.Clear();
TextBlock2.TextDecorations.Clear()
기본적으로 Hyperlink 개체를 TextDecoration 사용하여 밑줄을 표시합니다. 다음 마크업 샘플은 Hyperlink이 밑줄과 함께 정의된 것과 밑줄 없이 정의된 것을 보여줍니다.
<!-- Hyperlink with default underline. -->
<Hyperlink NavigateUri="http://www.msn.com">
MSN Home
</Hyperlink>
<Run Text=" | " />
<!-- Hyperlink with no underline. -->
<Hyperlink Name="myHyperlink" TextDecorations="None"
MouseEnter="OnMouseEnter"
MouseLeave="OnMouseLeave"
NavigateUri="http://www.msn.com">
My MSN
</Hyperlink>
TextDecoration 개체는 특히 개체가 많은 Hyperlink 경우 인스턴스화하는 데 성능 집약적일 수 있습니다. 자세한 내용은 방법: 하이퍼링크 밑줄 지정 여부를 참조하세요.
설명
텍스트 장식에는 기준선, 오버라인, 취소선 및 밑줄의 네 가지 유형이 있습니다. 다음 예제에서는 텍스트를 기준으로 텍스트 장식의 위치를 보여 줍니다.
텍스트 장식 형식의 예
XAML 특성 사용
<object textDecorationsProperty="textDecorationType[,textDecorationType]"/>
XAML 값
textDecorationType 텍스트 장식의 형식: Baseline, OverLine, Strikethrough또는 Underline. 쉼표로 구분된 값을 사용하여 두 개 이상의 장식이 허용됩니다. 텍스트 장식 유형을 나타내기 위해 "없음"을 지정할 수도 있습니다.
속성
| Name | Description |
|---|---|
| Baseline |
기준선을 TextDecoration지정합니다. |
| OverLine |
오버라인 TextDecoration을 지정합니다. |
| Strikethrough |
취소선 (취소선 TextDecoration)을 지정합니다. |
| Underline |
밑줄 TextDecoration을 지정합니다. |