c# - 禁用除滚动之外的 DataGridView

标签 c# datagridview disabled-control

我如何配置 datagridview 以便用户只能在行中移动并使用滚动条,而不能使用其他... 如果我禁用网格不允许我使用滚动

最佳答案

将您的 datagridview 设置为只读,这将禁用任何编辑。

dataGridView1.ReadOnly = true;

在你的处理程序中,做:

void dataGridView1_DoubleClick(object sender, EventArgs e)
{
     if (dataGridView1.ReadOnly == true)
          return;

     // .. whatever code you have in your handler...
}

即使用户双击网格,也不会发生任何事情。

关于c# - 禁用除滚动之外的 DataGridView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12750518/

相关文章:

c# - 如何干净地暂停一个线程,直到另一个线程完成或更改一个值

c# - 在 MySQL 上使用 SELECT 检索 DataGridView 中的数据

c# - 使用 DataSource 在 DataGridView 中显示 XML 数据

arrays - jQuery 选项卡 : disable first tab, 选择第二个

button - 禁用红色 'X' 按钮关闭整个带有 Java8 的 JavaFX 程序?

c# - 从 EventStore 获取事件

c# - 将数据类型 nvarchar 转换为 bigint 时出错

c# - 如何使用我自己的类作为 edmx 模型类?

mysql - 如何使用vb.net在sql server上创建表,其中名称由用户输入

iOS/Xcode : Name button created in storyboard name so it can be disabled