■ RotateTransform 엘리먼트를 사용해 좌우대칭 반사 텍스트를 회전하는 방법을 보여준다.
▶ 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 |
<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="RotateTransform 엘리먼트 : 좌우대칭 반사 텍스트 회전하기" FontFamily="나눔고딕코딩" FontSize="16"> <Canvas> <Canvas.Resources> <FontFamily x:Key="FontFamilyKey">Times New Roman</FontFamily> <s:Double x:Key="FontSizeDoubleKey">96</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="Reflect" /> <Setter Property="Canvas.Left" Value="288" /> <Setter Property="Canvas.Top" Value="192" /> </Style> </Canvas.Resources> <TextBlock> <TextBlock.RenderTransform> <RotateTransform Angle="45" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> </TextBlock.RenderTransform> </TextBlock> <TextBlock> <TextBlock.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="-1" /> <RotateTransform Angle="45" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> </TransformGroup> </TextBlock.RenderTransform> </TextBlock> <TextBlock> <TextBlock.RenderTransform> <TransformGroup> <ScaleTransform ScaleY="-1" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> <RotateTransform Angle="45" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> </TransformGroup> </TextBlock.RenderTransform> </TextBlock> <TextBlock> <TextBlock.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="-1" ScaleY="-1" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> <RotateTransform Angle="45" CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" /> </TransformGroup> </TextBlock.RenderTransform> </TextBlock> </Canvas> </Window> |