■ TextBlock 엘리먼트의 TextDecorations 속성을 사용하는 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="800" Height="600" Title="TextBlock 엘리먼트 : TextDecorations 속성 사용하기" FontFamily="나눔고딕코딩" FontSize="16"> <Window.Resources> <Style TargetType="TextBlock"> <Setter Property="Margin" Value="20" /> <Setter Property="FontSize" Value="32" /> <Setter Property="Text" Value="The quick red fox" /> </Style> </Window.Resources> <Grid> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock TextDecorations="None" /> <TextBlock> <TextBlock.TextDecorations> <TextDecorationCollection> <TextDecoration PenOffset="2" PenOffsetUnit="Pixel" PenThicknessUnit="Pixel" /> </TextDecorationCollection> </TextBlock.TextDecorations> </TextBlock> <TextBlock> <TextBlock.TextDecorations> <TextDecorationCollection> <TextDecoration Location="Baseline" PenOffset="2" PenOffsetUnit="Pixel" PenThicknessUnit="Pixel"> <TextDecoration.Pen> <Pen Thickness="1" Brush="Maroon" /> </TextDecoration.Pen> </TextDecoration> </TextDecorationCollection> </TextBlock.TextDecorations> </TextBlock> <TextBlock> <TextBlock.TextDecorations> <TextDecorationCollection> <TextDecoration PenThicknessUnit="FontRecommended"> <TextDecoration.Pen> <Pen Brush="Red" Thickness="1" /> </TextDecoration.Pen> </TextDecoration> </TextDecorationCollection> </TextBlock.TextDecorations> </TextBlock> <TextBlock> <TextBlock.TextDecorations> <TextDecorationCollection> <TextDecoration PenThicknessUnit="FontRecommended"> <TextDecoration.Pen> <Pen Thickness="1.5"> <Pen.Brush> <LinearGradientBrush StartPoint="0 0.5" EndPoint="1 0.5" Opacity="0.5"> <LinearGradientBrush.GradientStops> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Pen.Brush> <Pen.DashStyle> <DashStyle Dashes="2" /> </Pen.DashStyle> </Pen> </TextDecoration.Pen> </TextDecoration> </TextDecorationCollection> </TextBlock.TextDecorations> </TextBlock> <TextBlock TextDecorations="Strikethrough" /> <TextBlock TextDecorations="Underline, Overline" /> </StackPanel> </Grid> </Window> |