나는 C#에서 텍스트 상자에 임의의 단어를 입력하여 타이핑 테스트를하려고합니다. 사용자가 단어 입력을 마쳤 으면 공간을 누르거나 다음 단어로 이동하기 위해 입력 할 수 있기를 원합니다. SPACEBAR 또는 ENTER 키의 입력을 인식하도록 프로그램을 가져올 수 있다면 나머지 작업 방법을 알고 있습니다. 이것은 내 코드이며 내 코드에 어떤 기능을 추가해야합니까?C#에서 타이핑 테스트하기
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Forms;
namespace DesktopApplication
{
public partial class Form1 : Form
{
string[] randomWords = new string[] {
"Adult",
"Aeroplane",
"Air",
"Aircraft",
"Carrier",
"Airforce",
"Airport",
"Album",
"Alphabet",
"Apple",
"Army",
"Baby",
"Baby",
"Backpack",
"Balloon",
"Banana",
"Bank",
"Barbecue",
"Bathroom",
"Cappuccino",
"Car",
"Car",
"Carpet",
"Carrot",
"Cave",
"Chair",
"Chess",
"Drill",
"Drink",
"Drum",
"Dung"};
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label1_Click_1(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "Welcome to the typing test!";
label2.Text = "Type all the words that appear in the box below";
label3.Text = "";
button1.Text = "Press when ready to begin";
}
private void label1_Click_2(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label3.Text = randomWords[new Random().Next(0, randomWords.Length)];
}
}
}
참고 자료를 읽어보십시오. [Keypress 이벤트] (https://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress (v = vs.110) .aspx) –
안녕하세요. 먼저 여기에 질문하기 전에 웹 및 커뮤니티를 검색해야하지만 어쨌든 최선을 다해 도와 드리겠습니다. – Emad
@ P.Pat 'KeyPress'에 입력 키와 스페이스 키는 어떻게해야합니까? – Emad