zoukankan      html  css  js  c++  java
  • Silverlight 中实现 marquee 的效果 滚动显示 火麒

    <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" BorderThickness="0" Height="36">
                    <Canvas Loaded="MarqueeControl_Loaded" Width="592" HorizontalAlignment="Left">
                                  <Canvas.Resources>
                            <Storyboard x:Name="sb">
                                <DoubleAnimation x:Name="da" BeginTime="00:00:02" Storyboard.TargetName="txtLorem" Storyboard.TargetProperty="(Canvas.Left)" From="0" RepeatBehavior="Forever"/>
                            </Storyboard>
                        </Canvas.Resources>
                        <TextBlock x:Name="txtLorem" Width="596" Height="33" Text="滚动文字内容..."/>
                    </Canvas>
    </ScrollViewer>

    void MarqueeControl_Loaded(object sender, RoutedEventArgs e)
            {
                var canvas = sender as Canvas;
                if (txtLorem.ActualWidth <= canvas.Width) return;
                const double speed = 50;
                da.To = -txtLorem.ActualWidth;
                da.Duration = new Duration(TimeSpan.FromSeconds(txtLorem.ActualWidth / speed));
                sb.Begin();
            }

  • 相关阅读:
    filebeat6.2.3收集多个日志源 多个topic输出
    使用 INSERT 和 SELECT 子查询插入行
    Filebeat的架构分析、配置解释与示例
    struts1 logic标签的使用
    HDFS之一:hdfs命令行操作
    SQL子查询
    IE6动态插入option
    (转)CSS 圆角背景与三角形
    javascript 测试工具abut发布
    javascript天然的迭代器
  • 原文地址:https://www.cnblogs.com/firekylin/p/2025009.html
Copyright © 2011-2022 走看看