DataGridView的项目双击 [英] DataGridView item double click

查看:118
本文介绍了DataGridView的项目双击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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.

这篇关于DataGridView的项目双击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆