表示された問題の文章をまねして入力する、単純なタッチタイピング練習ソフトです。
public class TestApp
{
public static void Main()
{
System.Windows.Forms.Application.Run(new MainForm());
}
}
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label c1;
private System.Windows.Forms.TextBox c2;
private System.String[] c3;
private int c4;
public MainForm()
{
this.Width = 300;
this.Height = 150;
this.Text = "タッチタイピング練習ソフト";
c1 = new System.Windows.Forms.Label();
c1.Top = 10;
c1.Left = 10;
c1.AutoSize = true;
this.Controls.Add(c1);
c2 = new System.Windows.Forms.TextBox();
c2.Top = 40;
c2.Left = 10;
c2.Width = 250;
c2.KeyDown += c2_KeyDown;
this.Controls.Add(c2);
c3 = new System.String[10] {
"むかしむかし",
"あるところに",
"おじいさんとおばあさんが",
"すんでいました",
"おじいさんは",
"やまへしばかりに",
"おばあさんは",
"かわへせんたくにいきました",
"そこへおおきなももが",
"ながれてきました"
};
c4 = 0;
mondai(c4);
}
private void mondai(int i)
{
c1.Text = c3[i % c3.Length];
c2.Text = "";
}
private void c2_KeyDown(object btn, System.Windows.Forms.KeyEventArgs e)
{
if ((e.KeyData & System.Windows.Forms.Keys.Enter) == System.Windows.Forms.Keys.Enter)
{
if (c1.Text == c2.Text)
{
mondai(++c4);
}
}
}
}