c# - 按 T​​AB 键时绕过 DataGridView 中的只读单元格

标签 c# winforms datagridview

谁能告诉我一些代码,告诉我如何在按 TAB 键时绕过 DatagridView 中的只读单元格?

最佳答案

private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
   if (dataGridView1.CurrentRow.Cells[e.ColumnIndex].ReadOnly)
    {
        SendKeys.Send("{tab}");
    }
}

关于c# - 按 T​​AB 键时绕过 DataGridView 中的只读单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/751981/

相关文章:

c# - 用户将文件拖到我的 winforms 可执行文件上。我要创建一些事件监听器吗?

c# - Winforms,通过表单名称创建表单实例

c# - 为数据绑定(bind)的 datagridview 实现虚拟模式

c# - 有没有办法将数据库记录视为对象

c# - 无法应用运算符 &&

c# - 如何将 int 或 bool 转换为 checkState

c# - DataGridView 和数据源将不清晰

c# - 数据关系插入和外键

c# - 尝试将对象添加到类中的列表时出现 "Object reference not set to an instance of an object"错误

c# - 在 wpf 中创建自定义用户控件以供重用