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、效果图:
时间: 2024-10-13 22:09:47