禁用DataGridView中除了滚动 [英] Disable DataGridView except the scroll
本文介绍了禁用DataGridView中除了滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何配置一个DataGridView,这样如果我禁用网格不允许我使用滚动,用户只能通过行移动和使用滚动,而不是其他...
How I can configure a datagridview so that the user can only move through the rows and use the scroll, and nothing else... If I disable the grid not allow me to use the scroll
推荐答案
设置你的datagridview为只读,这将禁用所有编辑。
Set your datagridview to read-only, this will disable any edits.
dataGridView1.ReadOnly = true;
和您的处理程序里面,做的:
And inside your handlers, do :
void dataGridView1_DoubleClick(object sender, EventArgs e)
{
if (dataGridView1.ReadOnly == true)
return;
// .. whatever code you have in your handler...
}
$任何代码b $ b
即使对电网的用户双击,什么都不会发生。
Even if the user double-clicks on the grid, nothing will happen.
这篇关于禁用DataGridView中除了滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文