1. Open the Visual Studio 2010-->File -->New-->Project-->Select Windows Form
Application -->ClickOK
2. From the Tool Box Take one Label And one Timer
Control.
3. Change the Timer and Label Names
4. Then Write the Below Code in Form1.CS File.
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 WindowsFormsApplication5
{
public partial class Form1 : Form
{
private int xPos = 0,
YPos = 0;
public Form1()
{
InitializeComponent();
}
private void
timer1_Tick(object sender, EventArgs e)
{
if (xPos == 0)
{
this.lblText.Location = new System.Drawing.Point(this.Width, YPos);
xPos = this.Width;
}
else
{
this.lblText.Location = new System.Drawing.Point(xPos,
YPos);
xPos -= 2;
}
}
private void
Form1_Load(object sender, EventArgs e)
{
lblText.Text = "Hello this is marquee
text";
xPos = lblText.Location.X;
YPos = lblText.Location.Y;
timer1.Start();
}
}
}
5. After The Writing Code We Can Get output like This
Below:
Thank you for this aritcle..... Can you please explain how can i use marquee tag in asp.net web page using VS 2010
ReplyDeletehttp://anshulbajpai.blogspot.in/2011/05/marquee-property.html
Deletehttp://www.mountaindragon.com/html/marquee.htm