gridControl 双击、单击 获取当前行 事件方法
要响应GridView的单击或者双击事件,要设置GridView的OptionsBehavior.Editable=false。如果为true,它是不会响应这这两个事件的。 它本的的机制就是这样,祥细说明请看: The DoubleClick event occurs when the end user double-clicks within a view. The DoubleClick event does not occur if an in-place editor is activated as a result of double-clicking as well as when double-clicking within the GridControl.EmbeddedNavigator.
private void gridControl_GYH_MouseDoubleClick(object sender, MouseEventArgs e)
{
string st = "";
ColumnView cv = (ColumnView)gridControl_GYH.FocusedView;//重新获取此ID 否则无法从表头连删获取不到id
int focusedhandle = cv.FocusedRowHandle;
object rowIdObj = gridView1.GetRowCellValue(focusedhandle, "工艺号");
// string aa =gridView1.GetSelectedRows
//得到当前行的RowHandle
DataRow myDataRow = gridView1.GetDataRow(gridView1.FocusedRowHandle);
st = myDataRow["工艺号"].ToString();
MessageBox.Show(st);
}
参考自:https://blog.csdn.net/szyone/article/details/9242863
加上自己的代码