■ ScaleTransform 엘리먼트를 사용해 텍스트 그림자를 만드는 방법을 보여준다.
▶ 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 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" Width="800" Height="600" Title="ScaleTransform 엘리먼트 : 텍스트 그림자 만들기" FontFamily="나눔고딕코딩" FontSize="16"> <Canvas> <Canvas.Resources> <FontFamily x:Key="FontFamilyKey">Times New Roman</FontFamily> <s:Double x:Key="FontSizeDoubleKey">144</s:Double> <TransformGroup x:Key="TransformGroupKey"> <ScaleTransform ScaleX="{Binding Source={StaticResource FontFamilyKey}, Path=Baseline}" /> <ScaleTransform ScaleX="{StaticResource FontSizeDoubleKey}" /> </TransformGroup> <Style TargetType="{x:Type TextBlock}"> <Setter Property="FontFamily" Value="{StaticResource FontFamilyKey}" /> <Setter Property="FontSize" Value="{StaticResource FontSizeDoubleKey}" /> <Setter Property="Text" Value="Shadow" /> <Setter Property="Canvas.Left" Value="96" /> <Setter Property="Canvas.Top" Value="192" /> </Style> </Canvas.Resources> <TextBlock Foreground="DarkGray"> <TextBlock.RenderTransform> <TransformGroup> <ScaleTransform ScaleY="3" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> <SkewTransform AngleX="-45" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> </TransformGroup> </TextBlock.RenderTransform> </TextBlock> <TextBlock /> </Canvas> </Window> |