日期:2014-05-18 浏览次数:21040 次
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Tab) e.Handled = true;
}
------解决方案--------------------
private void dataGridView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Tab)
{
int row = this.dataGridView1.CurrentCell.RowIndex;
int cel=this.dataGridView1.CurrentCell.ColumnIndex;
row = (row + 2) % this.dataGridView1.Rows.Count;
this.dataGridView1.CurrentCell = this.dataGridView1.Rows[row].Cells[cel];
}
}