一个window窗体 点击开始的话 从窗体上会落下字母到下面,然后有个计时器试剑石20秒,每一个字母都随即的落下 一个落玩再落下一个,当你在下落的期间按键盘上的字母和窗体里的一样的话,那么窗体里的那个字母将会消失,然后在落下一个。20秒过后,计算你输入正确的字数~~~
哪位大虾帮忙解决下

解决方案 »

  1.   

    吼吼,有代码有真相,你改改就可以了,现在没有计算速度的功能。
    http://download.csdn.net/source/2776957
      

  2.   

        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            int TotalTime = 20;
            Random ran = new Random();
            int FormWidth = 0;//窗体宽度变量
            int FormHeight = 0;//窗体高度变量
            //关闭按钮
            private void toolStripButton2_Click(object sender, EventArgs e)
            {
                this.Close();
            }
            //取字母
            private char ProduceLetter()
            {
                int charValue = ran.Next(65, 123);//确保产生的字符的ASCALL编码范围在65到122之间。
                while (true)
                {
                    if ((charValue >= 65 && charValue <= 90) || (charValue >= 97 && charValue <= 122))
                    {
                        //如果产生的字符是小写字符或者是大写字符的时候。跳出while循环
                        break;
                    }
                }
                return Convert.ToChar(charValue);
            }        private void LetterPoint(char c, int width, int height)
            {
                int x = ran.Next(0, FormWidth);
                Label l = new Label();
                l.Width = 50;
                l.Height = 20;
                l.BackColor = Color.Red;
                l.Text = c.ToString();
                l.Location = new Point(x, FormHeight); 
                this.Controls.Add(l);
            }        private void location() 
            {        }
            //timer1_Tick对时间进行 控制;
            private void timer1_Tick(object sender, EventArgs e)
            {
                
                this.label1.Text = TotalTime--.ToString();
                if (TotalTime == 0)
                {
                    timer1.Stop();
                    MessageBox.Show("Time Over", "Register", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }        }
            //开始调用函数
            private void toolStripButton1_Click(object sender, EventArgs e)
            {            LetterPoint(ProduceLetter(), FormWidth, FormHeight);            timer1.Enabled = true;
            }
            //timer2_Tick控制字母的下落速度;
            private void timer2_Tick(object sender, EventArgs e)
            {
                FormHeight = FormHeight--;
                if (FormHeight == 0) 
                {
                    FormHeight = 0;
                }
            }
            //载入窗体时计算长宽
            private void Form1_Load(object sender, EventArgs e)
            {
                FormWidth = this.Width;
                FormHeight = this.Height;
            }
        }
    }
      

  3.   

    http://topic.csdn.net/u/20080330/10/ced80fc7-8217-4ab2-8813-c2f5c728e10f.html
      

  4.   

    这个用VB做过,C#应该更简单些