如何在双击GridControl时执行操作

时间:2012-02-07 22:30:42

标签: c# winforms devexpress xtragrid

我有GridControl

    private void gridControl1_DoubleClick(object sender, EventArgs e)
    {
        GridControl grid = sender as GridControl;            
        DXMouseEventArgs args = e as DXMouseEventArgs;
        BaseHitInfo hitInfo = grid.Views[0].CalcHitInfo(args.Location);
        MessageBox.Show("Hello World");
    }

如果用户双击行数据,我该如何显示MessageBox.Show("Hello World")?即使用户双击空格,上面的代码也显示了hello world。

1 个答案:

答案 0 :(得分:3)

hitInfo投放到GridHitInfo并检查HitTest属性。