Exemple #1
0
        public void moveText(string txt)
        {
            TxtInterfaceBottom.Text = txt;

            DoubleAnimation anime = new DoubleAnimation();

            anime.To             = ShapeMeasure(TxtInterfaceBottom).Width / 2;
            anime.From           = -ShapeMeasure(TxtInterfaceBottom).Width;
            anime.RepeatBehavior = RepeatBehavior.Forever;
            anime.Duration       = TimeSpan.FromSeconds(txt.Replace(" ", "").Length *0.4 < 10? 15: txt.Replace(" ", "").Length * 0.4);
            TxtInterfaceBottom.BeginAnimation(Canvas.RightProperty, anime);
        }
Exemple #2
0
        public void setText(string sText, double dWidth, int iTime)
        {
            TxtInterfaceBottom.Text = sText;
            double dTextLength   = TxtInterfaceBottom.Text.Length;
            double dTextTime     = dTextLength / iTime;
            Size   TextBlockSize = ShapeMeasure(TxtInterfaceBottom);

            DoubleAnimation doubleAnimation = new DoubleAnimation();

            doubleAnimation.From           = -TextBlockSize.Width;
            doubleAnimation.To             = dWidth;
            doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
            //doubleAnimation.Duration = new Duration(Timeli);//TimeSpan.FromSeconds(dTextTime));
            TxtInterfaceBottom.BeginAnimation(Canvas.RightProperty, doubleAnimation);
        }