DataGridView 鼠标双击获得行列索引

如果是CellDoubleClick事件,可以在事件的参数e里获取列索引及行索引。
也可以通过CurrentCell来获取当前选中的单元格的列索引及行索引。

参考:
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
string name0=this.dataGridView1.Columns[e.ColumnIndex].Name;
//string name1=this.dataGridView1.Columns[this.dataGridView1.CurrentCell.ColumnIndex].Name;
}
posted @ 2017-10-12 17:01  dxm809  阅读(209)  评论(0编辑  收藏  举报