日期:2014-05-17  浏览次数:20743 次

c#键盘事件,我的程序没反应啊
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 123{
  public partial class Form1 : Form
  {
  public Form1()
  {
  InitializeComponent(); 
  //textBox1.Text = "你按下了〈Enter〉键";
  }
  private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  {
  if (e.KeyChar == (char)Keys.Enter)
  textBox1.Text = "你按下了〈Enter〉键";
  }
  }
}

------解决方案--------------------
探讨
if (e.KeyChar == (char)Keys.a&&(char)Keys.b)?你要表达的是什么 a和b一起按?
没有这样的 亲