DataGridView的项目双击双击、项目、DataGridView

由网友(有一些记忆丶挥之不去)分享简介:我有一个Windows窗体一个DataGridView。我要处理的每个单元上双击事件以显示与该记录详细信息表单。不幸的是,双击事件被执行时,您双击列标题。我该怎么办?I have a DataGridView in a Windows Form. I want to handle double click event...

我有一个Windows窗体一个DataGridView。我要处理的每个单元上双击事件以显示与该记录详细信息表单。不幸的是,双击事件被执行时,您双击列标题。我该怎么办?

I have a DataGridView in a Windows Form. I want to handle double click events on each cell to display a detail form related to that record. Unfortunately, the double click event is executed when you double click on column headers. What should I do?

推荐答案

您应该检查 rowIndex位置参数:columnIndex 的事件参数属性。如果其中一个是否定的,则意味着是行头或一列标题被点击,则应该忽略该事件。

You should check the RowIndex and ColumnIndex property of the event arguments. If one of them is negative, it means that either a row header or a column header is clicked, you should ignore that event.

阅读全文

相关推荐

最新文章