|
Text Scrolling effect in windows Application using csharp
08/03/2017 02:49:56 PM
Hello,in this c# tutorial i will explain how to give scrolling effect to text means,moving the text
like HTML marquee tag is a scrolling text displayed either horizontally or vertically on webpage
we give same scrolling text effect in windows application using c#
1. Open VisualStudio.Net / Select C# / Windows Application
2.Add following controls on form
One Lable and Timer from ToolBox of VisualStudio
3.Set Lable's Text property=Welcome To Simply Learn Programming
4.Set Timer Enabled=True by default it is False.
5.Add the following code on timer_tick event
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 AutoTextScroll
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
lbltxt.Left = lbltxt.Left - 20;
if (lbltxt.Left + lbltxt.Width <= 0)
{
lbltxt.Left = this.Width;
}
}
}
}
To change text scrolling speed change timer Interval property.which is default 100 i.e 1000 milliseconds
Output
|