gridView 编辑单元格获取单元格焦点位置(位于单元格的焦点位置)
1、主要代码:
private void Form1_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("A"); dt.Columns.Add("B"); for (int i = 0; i < 20; i++) { dt.Rows.Add(i + 1, "测试数据0000" + i); } gridControl1.DataSource = dt; } private void txt_MouseUp(object sender, MouseEventArgs e) { TextEdit txt = gridView1.ActiveEditor as TextEdit; int a = txt.SelectionStart; MessageBox.Show("鼠标当前坐标"+a); }
2、效果图: