C#如何获取DataGridView对象的行列索引

 时间:2024-10-11 20:11:59

1、我们需要在事件列表中找到DataGridView对象的CellClick事件。

C#如何获取DataGridView对象的行列索引

2、在此事件中,我们会有DataGridCiewCellEventArgs事件变量e。

C#如何获取DataGridView对象的行列索引

3、此时我们便能利用DataGridCiewCellEventArgs事件变量e的RowIndex属性获得行索引,但是我们需要加1。

C#如何获取DataGridView对象的行列索引

4、不仅如此,既然有RowIndex属性肯定也有ColumnIndex属性,同样加1。

C#如何获取DataGridView对象的行列索引

5、或者我们还能用过DataGridView对象的CurrentCell活动单元格属性组中的RowIndex属性获得加1。

C#如何获取DataGridView对象的行列索引

6、并且还能通过CurrentCellAddress属性组的X和Y坐标,也是能够获得行列索引。

C#如何获取DataGridView对象的行列索引
  • js怎么判断事件是否绑定
  • jquery如何新增一个元素
  • 数据库OraClient Lite-11g的安装
  • 怎样更新VS 2013 update 4
  • 热门搜索
    柳州旅游景点 红旗渠旅游 恒大世纪旅游城 旅游相关 铜陵旅游景点大全 宜兰旅游攻略 蜀南竹海旅游 豪华游轮旅游攻略 9月份适合去哪里旅游 怎么去香港旅游