Ad

Thursday, August 15, 2013

Text Scrolling in Windows Form Using C#.Net

Overview:
                   In this article i would like to publish an article Text Scrolling in Windows Form Using C#.Net.


Description:
                    Windows form has an properties of left and width by using those properties we can make it.

Logic: Label1.Left=Label1.Left-20;(For Right To Left Scrolling)
           Label1.Left=Label1.Left+20;(For Left To Right Scrolling)

Program:
Steps To Design a Form:
1.Take One Label.Give any Name(i.e go to Text Property give the name,if you want change font etc)
2.Take One Timer Controller.If you want change the text of the form also.
Now the Form looks as follows as


Text Scrolling in Windows Form Using C#.Net
3.Double Click on Timer control and write the following code


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Marqueescrolling
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Left = label1.Left - 20;
            if (label1.Left + label1.Width <= 0)
            {
                label1.Left = this.Width;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }
    }
}

 Output:
Text Scrolling in Windows Form Using C#.Net

Protected by Copyscape Original Content Checker