Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this code, is for move a text Marquee as you can see in the newscasts. It working in Windows Form, but not in WPF.
C#
this.Refresh();
myLabel2.Left += 5;
if (myLabel2.Left >= this.Width)
{
    myLabel2.Left = myLabel2.Width * -1;
}

I want to create that Text Marquee for fresh news. In a TextBox you can add a fresh news, and later in a TextBlock is updated. Somebody have a idea?

I will appreciate too! I'm new with .net and I have a big proyect :$
Posted
Updated 20-May-15 12:31pm
v2

1 solution

Try applying animation to the textbox.
Something similar to the below code.
C#
void Window1_Loaded(object sender, RoutedEventArgs e)

    {

        DoubleAnimation doubleAnimation = new DoubleAnimation();

        doubleAnimation.From = -tbmarquee.ActualWidth;

        doubleAnimation.To = canMain.ActualWidth;

        doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

        doubleAnimation.Duration = new Duration(TimeSpan.Parse("0:0:10"));

        tbmarquee.BeginAnimation(Canvas.LeftProperty, doubleAnimation);

    }


Reference:
http://stackoverflow.com/questions/20145212/[^]

Making a Simple Marquee Text Control, Drip Animation and Roll Animation in WPF[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900