datagridview所选单元格的位置 [英] datagridview selected cells location

查看:419
本文介绍了datagridview所选单元格的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在数据gridview中获取所选单元格的位置.
我想使用Lable用颜色填充所选单元格,但我无法找到位置.请展示如何获得它..

谢谢.

How to get the location of the selected cells in data gridview.
I want to fill the selected cells with color using Lable but i cant get the location. plz show the way to get it..

Thanks.

推荐答案

这很简单,处理EventHandler DataGridView_CellContentDoubleClick(...)或ataGridView_CellContentClick(...)

试试这个代码

私有void DataGridView_CellContentDoubleClick(对象发送者,DataGridViewCellEventArgs e)
{
int i = e.ColumnIndex;
int j = e.RowIndex
}
it is very simple, processing EventHandler DataGridView_CellContentDoubleClick(...) or ataGridView_CellContentClick(...)

try this code

private void DataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
int i = e.ColumnIndex;
int j = e.RowIndex
}


这篇关于datagridview所选单元格的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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