728x90
반응형
728x170
■ ScaleTransform 엘리먼트를 사용해 좌우대칭 반사 텍스트를 만드는 방법을 보여준다.
▶ MainWindow.xaml
<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">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="384" />
<Setter Property="Canvas.Top" Value="48" />
</Style>
</Canvas.Resources>
<TextBlock />
<TextBlock>
<TextBlock.RenderTransform>
<ScaleTransform ScaleX="-1" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock>
<TextBlock.RenderTransform>
<ScaleTransform
ScaleY="-1"
CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock>
<TextBlock.RenderTransform>
<ScaleTransform
ScaleX="-1"
ScaleY="-1"
CenterY="{Binding Source={StaticResource TransformGroupKey}, Path=Value.M11}" />
</TextBlock.RenderTransform>
</TextBlock>
</Canvas>
</Window>
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] Point 구조체 : 회전하기 (0) | 2020.09.07 |
---|---|
[C#/WPF] Point 구조체 : 기울이기 (0) | 2020.09.07 |
[C#/WPF] Point 구조체 : 확대/축소하기 (0) | 2020.09.07 |
[C#/WPF] Point 구조체 : 이동하기 (0) | 2020.09.07 |
[C#/WPF] RotateTransform 엘리먼트 : 좌우대칭 반사 텍스트 회전하기 (0) | 2020.09.07 |
[C#/WPF] RotateTransform 클래스 : 텍스트 회전하기 (0) | 2020.09.07 |
[C#/WPF] ScaleTransform 엘리먼트 : 하강 문자(descender)가 포함된 텍스트 그림자 만들기 (0) | 2020.09.07 |
[C#/WPF] ScaleTransform 엘리먼트 : 텍스트 그림자 만들기 (0) | 2020.09.07 |
[C#/WPF] TextBox 엘리먼트 : 입력한 텍스트가 없는 경우 배경 메시지 보여주기 (0) | 2020.09.07 |
[C#/WPF] 1차 방정식 직선을 기준으로 대칭 포인트 구하기 (0) | 2020.09.06 |
댓글을 달아 주세요