实现DevExpress GridControl 只有鼠标双击后才进行修改数据

时间:2023-03-08 15:44:16

1. 实现DevExpress GridControl 只有鼠标双击后才进行修改数据:修改GridView.OptionsBehavior.EditorShowMode属性为Click  

2. 实现DevExpress GridControl 只有鼠标双击后才进行修改数据:修改GridView.OptionsBehavior.EditorShowMode属性为MouseDownFocused

然后实现下面代码:

private void gridView1_MouseDown(object sender, MouseEventArgs e)
{
GridView view = sender as GridView;
GridHitInfo hitInfo = view.CalcHitInfo(e.Location);
if (hitInfo.InRowCell && e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (e.Clicks == )
{
view.FocusedColumn = hitInfo.Column;
view.FocusedRowHandle = hitInfo.RowHandle; }
else if (e.Clicks == )
view.ShowEditor();
DXMouseEventArgs.GetMouseArgs(e).Handled = true;
}
}