文件名称:C#我设置好右键菜单以后,怎么样获取右键点击的是哪一单元格
文件大小:688B
文件格式:TXT
更新时间:2012-10-10 08:20:11
C#,右键菜单,获取,右键点击,单元格,dataGridView
我设置好右键菜单以后,怎么样获取右键点击的是哪一单元格 Point p = new Point(contextMenuStrip1.Left, contextMenuStrip1.Top); for (int r = 0; r < dataGridView1.RowCount; r++) { for (int c = 0; c < dataGridView1.Columns.Count; c++) { Rectangle rect = dataGridView1.GetCellDisplayRectangle(c,r, false); if (dataGridView1.RectangleToScreen(rect).Contains(p)) { MessageBox.Show("row=" + r.ToString() + ",column=" + c.ToString()); break; } } } QQ:292258449