日期:2014-05-17 浏览次数:21213 次
public class MyDataGridView : DataGridView
{
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.E || keyData == Keys.Enter || keyData == Keys.I)
//上面一条做实验 条件是判断e,i,回车
{
MessageBox.Show("123");
return true;
}
return base.ProcessDialogKey(keyData);
}[code=csharp]
ProcessEnterKey(Keys keyData);
ProcessF2Key(Keys keyData);
ProcessEscapeKey(Keys keyData);
private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar ==(char) Keys.E)
{
MessageBox.Show("e");
}
if (e.KeyChar ==(char) Keys.Enter)
{
MessageBox.Show("enter");
}
}