日期:2014-05-20  浏览次数:21020 次

为什么字母不移动啊?
using   System;
using   System.Drawing;
using   System.Collections;
using   System.ComponentModel;
using   System.Windows.Forms;
using   System.Data;
using   System.Threading;

namespace   RandomWord
{
///   <summary>
///   Form1   的摘要说明。
///   </summary>
public   class   Form1   :   System.Windows.Forms.Form
{
private   System.Windows.Forms.Timer   timer1;
private   System.ComponentModel.IContainer   components;

private   int   _count=0;
public   Form1()
{
//
//   Windows   窗体设计器支持所必需的
//
InitializeComponent();

//
//   TODO:   在   InitializeComponent   调用后添加任何构造函数代码
//
}

///   <summary>
///   清理所有正在使用的资源。
///   </summary>
protected   override   void   Dispose(   bool   disposing   )
{
if(   disposing   )
{
if   (components   !=   null)  
{
components.Dispose();
}
}
base.Dispose(   disposing   );
}

#region   Windows   窗体设计器生成的代码
///   <summary>
///   设计器支持所需的方法   -   不要使用代码编辑器修改
///   此方法的内容。
///   </summary>
private   void   InitializeComponent()
{
this.components   =   new   System.ComponentModel.Container();
this.timer1   =   new   System.Windows.Forms.Timer(this.components);
//  
//   timer1
//  
this.timer1.Interval   =   5000;
this.timer1.Tick   +=   new   System.EventHandler(this.timer1_Tick);
//  
//   Form1
//  
this.AutoScaleBaseSize   =   new   System.Drawing.Size(6,   14);
this.ClientSize   =   new   System.Drawing.Size(292,   273);
this.Name   =   "Form1 ";
this.Text   =   "字符的随机产生 ";
this.KeyPress   +=   new   System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
this.Load   +=   new   System.EventHandler(this.Form1_Load);
this.Deactivate   +=   new   System.EventHandler(this.Form1_Deactivate);

}
#endregion

///   <summary>
///   应用程序的主入口点。
///   </summary>
[STAThread]
static   void   Main()  
{
Application.Run(new   Form1());
}

private   void   timer1_Tick(object   sender,   System.EventArgs   e)
{
Label   lbl1=new   Label();
lbl1.Name= " "+_count.ToString();

lbl1.Width=24;
lbl1.Height=24;
lbl1.ForeColor=System.Drawing.Color.White;
lbl1.BackColor=this.BackColor;
this.Controls.Add(lbl1);
System.Random   random=new   Random(DateTime.Now.Millisecond*DateTime.Now.Millisecond);
lbl1.Left=random.Next(this.Width);

Letter   letter=new   Letter(lbl1,this);
ThreadStart   threadStart=new   ThreadStart(letter.Run);
Thread   thread=new   Thread(threadStart);
thread.Start();
}

private   void   Form1_Load(object   sender,   System.EventArgs   e)
{
timer1.Start();
}