private void textBox3_KeyDown(object sender, KeyEventArgs e) { //Console.WriteLine("key down"); //过滤除了字母以及数字的按键 if (KeyboardTimeline.IsAvailableKey(e.KeyValue)) return; if ((Keys)e.KeyValue != Keys.Enter) timeline.MarkDown(e.KeyValue); //如果按下的是回车,代表输入已经完成 if((Keys)e.KeyValue == Keys.Enter) { //recordList.Add(timeline.ToVector()); if(MessageBox.Show("是否保存?", "保存", MessageBoxButtons.YesNo) == DialogResult.Yes) { recordList.Add(timeline.ToVector()); recordCounter++; //已经记录完毕 if(recordCounter > MAX_RECORD_REQUIRED) { return; } } } }
private void textBox3_KeyDown(object sender, KeyEventArgs e) { if ((Keys)e.KeyValue == Keys.Enter) { button2_Click(this, new EventArgs()); } //若还未开始记录,则返回 if (!recordStarted) { return; } if (e.KeyValue == (int)Keys.Back) { MessageBox.Show("不允许退格,该次输入无效!", "错误"); textBox3.Clear(); timeline = new KeyboardTimeline(); textBox3.Focus(); return; } //过滤除了字母以及数字的按键 if (KeyboardTimeline.IsAvailableKey(e.KeyValue)) { return; } if ((Keys)e.KeyValue != Keys.Enter) { timeline.MarkDown(e.KeyValue); } }
private void textBox3_KeyUp(object sender, KeyEventArgs e) { //Console.WriteLine("key up"); //过滤除了字母以及数字的按键 if (KeyboardTimeline.IsAvailableKey(e.KeyValue)) return; timeline.MarkUp(e.KeyValue); }
private void textBox2_KeyUp(object sender, KeyEventArgs e) { //过滤除了字母以及数字的按键 if (KeyboardTimeline.IsAvailableKey(e.KeyValue)) { return; } timeline.MarkUp(e.KeyValue); }
private void textBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == (int)Keys.Back || e.KeyValue == (int)Keys.Space) { MessageBox.Show("不允许退格或空格,该次输入无效!", "错误"); resetButton_Click(this, new EventArgs()); return; } //过滤除了字母以及数字的按键 if (KeyboardTimeline.IsAvailableKey(e.KeyValue)) { return; } timeline.MarkDown(e.KeyValue); }