我希望我的DataGridView光标在输入单元格数据后向右移动到下一列,而不是移动到下一行。我尝试通过捕获dataGridView1_KeyDown事件来控制光标,但这并不能防止光标在输入单元格数据后移动到下一行。谢谢您的帮助。祝好!
public class dgv : DataGridView
{
protected override bool ProcessDialogKey(Keys keyData)
{
Keys key = (keyData & Keys.KeyCode);
if (key == Keys.Enter)
{
return this.ProcessRightKey(keyData);
}
return base.ProcessDialogKey(keyData);
}
protected override bool ProcessDataGridViewKey(KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
return this.ProcessRightKey(e.KeyData);
}
return base.ProcessDataGridViewKey(e);
}
}