110,533
社区成员
发帖
与我相关
我的任务
分享
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (dataGridView1.CurrentRow.Index >= dataGridView1.RowCount) return;
if (e.KeyCode == Keys.Tab)
{
DataGridViewCell cell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex + 1];
dataGridView1.CurrentCell = cell;
e.Handled = true;
}
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
// 13楼代码
}
if (e.KeyCode == Keys.Tab || e.KeyCode == Keys.Tab && e.Shift == true)
{
DataGridViewCell cell;
if (dataGridView1.CurrentRow.Index < dataGridView1.RowCount - 1)
cell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex + 1];
else cell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex, 0];
dataGridView1.CurrentCell = cell;
e.Handled = true;
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Tab)
{
SendKeys.Send("{Enter}");
e.Handled = true;
}
}