private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Interval = 500;
this.timer1.Start();
}
Random r = new Random();
private void timer1_Tick(object sender, EventArgs e)
{
Label l = new Label();
char cc = (char)((int)'A' + r.Next(26));
l.Text = cc.ToString();
l.Left = r.Next(this.Width);
this.Controls.Add(l);
foreach (Control c in this.Controls)
{
c.Top += 15;
if (c.Top == this.Height) c.Dispose();
}
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
foreach (Control c in this.Controls)
{
if (c.GetType() == typeof(Label))
{
Label t = (Label)c;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载