110,500
社区成员
发帖
与我相关
我的任务
分享
private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 9)
{
this.dataGridView1.CurrentCell = this.dataGridView1[col, row];
MessageBox.Show("sdstttttttt");
}
}
this.dataGridView1.CurrentCell = this.dataGridView1[col, row];
int row = dataGridView1.CurrentCell.RowIndex;
int col = dataGridView1.CurrentCell.ColumnIndex;
this.dataGridView1.CurrentCell = this.dataGridView1[col, row];
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
//判断键盘按下的键。如果等于“enter”,则send一个“{tab}”。模拟按下“tab”键,实现单元格。向下移动
if (keyData == Keys.Enter && !btn_return.Focused && !btn_run.Focused)
{
System.Windows.Forms.SendKeys.Send("{tab}");
return true;
}
//继续原来base.ProcessCmdKey中的处理
return base.ProcessCmdKey(ref msg, keyData);
}