Marquee Text with NumericUpDown Control in C#

Today in C#, I will teach you how to create a program that has the marquee text functionality and has a NumericUpDown control to control the speed of the marquee text. We all know that in HTML, a marquee is a small section of the browser window that displays text that rolls across the screen. You use the MARQUEE element to create scrolling section. Now, let's start this tutorial! 1. Let's start with creating a Windows Form Application in C# for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application and name your project as marquee text. 2. Next, add Timer named Timer1, Label named Label1 and NumericUpDown control named NumericUpdown1. You must design your interface like this: design 3. Put this code for your Timer1_Tick.
  1.        
  2.                 public void Timer1_Tick(System.Object sender, System.EventArgs e)
  3.                 {
  4.                         Timer1.Interval = (int) NumericUpDown1.Value;
  5.                         Label1.Left = Label1.Left - 10;
  6.                         if (Label1.Left < 0 - Label1.Width)
  7.                         {
  8.                                 Label1.Left = this.Width;
  9.                         }
  10.                 }
We used Timer1 as a control to make the text moved with regards to the time as it ticks. The time interval of our timer1 is to be equal to the value inputted in NumericUpDown1. With the use NumericUpDown1, it can adjust the speed of the marquee text.Left properties here is for horizontal location. When the timer starts to tick, the label moved its location by decrementing by 10. If the label's left property is change to 0 then it will be equal to the with of the form making it to scroll again to the left. 4. Enable the Timer1 in the Form_Load. This will trigger to move the text in the right side to the left side.
  1. public void Form1_Load(System.Object sender, System.EventArgs e)
  2.                 {
  3.                         Timer1.Enabled = true;
  4.                 }
Output: output output For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer If you have some queries, feel free to contact the number or e-mail below. Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Add new comment