[英]Cursor moving to next cell in DataGridView
If I edit a DataGridViewTextBoxCell
in my DataGridView
and press the right arrow to move to the end of the string, when i reach the end of the string the cursor will leave the edit mode of that DataGridViewTextBoxCell
and select the DataGridViewTextBoxCell
next to it. 如果我编辑DataGridViewTextBoxCell
在我DataGridView
和按右箭头移动到字符串的结尾,当我到了字符串的结尾,光标会留下的编辑模式DataGridViewTextBoxCell
并选择DataGridViewTextBoxCell
旁边。
Is this default behavior? 这是默认行为吗?
Is there a way to keep the caret / cursor inside the current DataGridViewTextBoxCell
being edited? 有没有办法将插入符号/光标保留在当前正在编辑的DataGridViewTextBoxCell
中?
private bool dont_jump;
private int col_index;
private int row_index;
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
dont_jump = true;
col_index = e.ColumnIndex;
row_index = e.RowIndex;
}
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
if (dont_jump)
{
dont_jump= false;
dataGridView1.CurrentCell = dataGridView1[col_index, row_index];
}
}
Maybe this is working for you 也许这对你有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.