첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

■ TextBlock 엘리먼트의 TextEffects 속성을 사용하는 방법을 보여준다.

TestProject.zip
다운로드

▶ 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"
    Width="800"
    Height="600"
    Title="TextBlock 엘리먼트 : TextEffects 속성 사용하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <Border
            HorizontalAlignment="Center"
            VerticalAlignment="Center">
            <TextBlock
                Margin="50"
                FontSize="96">
                icodebroker
                <TextBlock.TextEffects>
                    <TextEffect x:Name="textEffect"
                        PositionCount="1">
                        <TextEffect.Transform>
                            <RotateTransform x:Name="rotateTransform"
                                CenterX="10"
                                CenterY="10"
                                Angle="0" />
                        </TextEffect.Transform>
                    </TextEffect>
                </TextBlock.TextEffects>
                <TextBlock.Triggers>
                    <EventTrigger RoutedEvent="TextBlock.Loaded">
                        <EventTrigger.Actions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <ParallelTimeline RepeatBehavior="Forever">
                                        <DoubleAnimation
                                            Storyboard.TargetName="rotateTransform"
                                            Storyboard.TargetProperty="Angle"
                                            From="0"
                                            To="360"
                                            BeginTime="0:0:0.25"
                                            Duration="00:00:0.75" />
                                    </ParallelTimeline>
                                    <DoubleAnimation
                                        Storyboard.TargetName="rotateTransform"
                                        Storyboard.TargetProperty="CenterX"
                                        RepeatBehavior="Forever"
                                        AutoReverse="True"
                                        From="30"
                                        To="370"
                                        Duration="00:00:13" />
                                    <Int32AnimationUsingKeyFrames
                                        Storyboard.TargetName="textEffect"
                                        Storyboard.TargetProperty="PositionStart"
                                        RepeatBehavior="Forever"
                                        AutoReverse="True"
                                        Duration="0:0:11">
                                        <Int32AnimationUsingKeyFrames.KeyFrames>
                                            <DiscreteInt32KeyFrame Value="0"  KeyTime="0:0:0"  />
                                            <DiscreteInt32KeyFrame Value="1"  KeyTime="0:0:1"  />
                                            <DiscreteInt32KeyFrame Value="2"  KeyTime="0:0:2"  />
                                            <DiscreteInt32KeyFrame Value="3"  KeyTime="0:0:3"  />
                                            <DiscreteInt32KeyFrame Value="4"  KeyTime="0:0:4"  />
                                            <DiscreteInt32KeyFrame Value="5"  KeyTime="0:0:5"  />
                                            <DiscreteInt32KeyFrame Value="6"  KeyTime="0:0:6"  />
                                            <DiscreteInt32KeyFrame Value="7"  KeyTime="0:0:7"  />
                                            <DiscreteInt32KeyFrame Value="8"  KeyTime="0:0:8"  />
                                            <DiscreteInt32KeyFrame Value="9"  KeyTime="0:0:9"  />
                                            <DiscreteInt32KeyFrame Value="10" KeyTime="0:0:10" />
                                        </Int32AnimationUsingKeyFrames.KeyFrames>
                                    </Int32AnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger.Actions>
                    </EventTrigger>
                </TextBlock.Triggers>
            </TextBlock>
        </Border>
    </Grid>
</Window>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요