C# 简单的windows窗体打字练习 一个window窗体 点击开始的话 从窗体上会落下字母到下面,然后有个计时器试剑石20秒,每一个字母都随即的落下 一个落玩再落下一个,当你在下落的期间按键盘上的字母和窗体里的一样的话,那么窗体里的那个字母将会消失,然后在落下一个。20秒过后,计算你输入正确的字数~~~哪位大虾帮忙解决下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 吼吼,有代码有真相,你改改就可以了,现在没有计算速度的功能。http://download.csdn.net/source/2776957 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; } }} http://topic.csdn.net/u/20080330/10/ced80fc7-8217-4ab2-8813-c2f5c728e10f.html 这个用VB做过,C#应该更简单些 请教同步时分复用、异步时分复用与分组交换的本质区别 C#或C#调用API能实现对整个磁盘的操作、控制吗? 如何解决文章内容分页问题!! 关于webbrowser的问题。 string.split问题 一个触发器问题请大家帮忙修改!很着急 求datagrid 如何在Web控件 datagrid 中正常显示出汉字? 关于窗体显示问题 "Namespace 名字空间" 是什么意思 ? 通俗点的 。 写程序改行开网店 控件名字改了,怎么关联起来
http://download.csdn.net/source/2776957
{
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;
}
}
}