获取dataGridView双击时判断双击的是下面的行,还是列头

private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
Point hit = this.dataGridView1.PointToClient(Cursor.Position);

DataGridView.HitTestInfo hitTest = this.dataGridView1.HitTest(hit.X, hit.Y);

MessageBox.Show(hitTest.Type + " Row=" + hitTest.RowIndex + " Col" + hitTest.ColumnIndex);
}

posted @ 2019-03-28 17:55  咖啡无眠  阅读(738)  评论(0编辑  收藏  举报