C# - Create a simple ticker

By , 8/23/2006
(1 ratings)
Create a simple ticker using a label
Translate to VB
// Designer
this.label1 = new System.Windows.Forms.Label();
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Text = "Hello World!";

private void Form1_Load(object sender, System.EventArgs e)
{
  Timer t1 = new Timer();
  t1.Interval = 20;
  t1.Tick+=new EventHandler(t1_Tick);
  t1.Start();
}

private void t1_Tick(object sender, EventArgs e)
{
  int i;               
  i = label1.Location.X; 
  if (i >= this.Width) 
    i = 0; 
  else 
    i = label1.Location.X + 1;               
  label1.Location = new Point(i,0);
}
Tagged with time, ticker.

Comments

 

Log in, to comment!