在texbox中对文本进行动画处理 [英] Animating text in texbox

查看:71
本文介绍了在texbox中对文本进行动画处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我需要一些有关如何为文本设置动画的帮助,以便使文本在WPF中的文本框或按钮上从上到下滚动?我知道它可以与动画功能一起使用,但是有人可以告诉我完整的代码吗?在此先谢谢您.

Hi guys! I need some help on how to animate text so that it is scrolling from top to bottom on a textbox or button in WPF? I know it works with animation functions but can someone please show me the full code? Thanks in advance.

推荐答案

您可以像这样使用DoubleAnimation为Y属性设置动画

You could use a DoubleAnimation to animate the Y property like this

<TextBlock Grid.Row="4" FontSize="24" HorizontalAlignment="Center">
                <TextBlock.RenderTransform>
                  <TranslateTransform x:Name="translate" />
                    </TextBlock.RenderTransform>
                      <TextBlock.Triggers>
                        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                            <BeginStoryboard>
                                <Storyboard RepeatBehavior="Forever">
                                    <DoubleAnimation

                                        From="100" To="-120"

                                        Storyboard.TargetName="translate"

                                        Storyboard.TargetProperty="Y"

                                        Duration="0:0:9" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </TextBlock.Triggers>
                    I am Scrolling
            </TextBlock>



希望对您有帮助



Hope this helps


这篇关于在texbox中对文本进行动画处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆