【问题标题】:DevExress XtraGrid MouseDown Event does not fire second timeDevExpress XtraGrid MouseDown 事件不会第二次触发
【发布时间】:2014-06-05 18:35:55
【问题描述】:

我的 XtraGrid 上有 MouseDown 事件,它不想在同一列上第二次触发。

它会识别第一次点击,但除非我在尝试点击原始行/列之前点击另一列或另一行,否则不会发生任何事情。

谁能告诉我我错过了什么?这是 MouseDown 事件中的代码:

         var hitInfo = gridViewSpecialty.CalcHitInfo(e.Location);
         if (hitInfo.InRowCell)
         {
             int nRow = hitInfo.RowHandle;
             GridColumn column = hitInfo.Column;
             LinkClick(nRow, column);

         }

谢谢!!鲍勃

【问题讨论】:

  • 以上代码在什么事件中?
  • gridView_MouseDown 事件。

标签: devexpress xtragrid mousedown


【解决方案1】:

这很可能是由于事件出错。我敢打赌,如果您在该声明周围加上Try{}catch{},您可能会陷入错误。

这是我在尝试使用网格捕获用户单击事件时使用的方法。我使用双击事件,像这样:

private void gcMainGrid_DoubleClick(object sender, EventArgs e)
{
    try
    {
        GridControl gc = (GridControl)sender;
        DevExpress.Utils.DXMouseEventArgs dxMEA = (DevExpress.Utils.DXMouseEventArgs)e;
        GridView gv = (GridView)gc.MainView;
        int iRowHandle = gv.CalcHitInfo(dxMEA.X, dxMEA.Y).RowHandle;

        //Check to see if the user is on a row.
    if (iRowHandle >= 0)
    {
        //Do something here.
    }
    catch(Exception ex)
    {
        if (Debugger.IsAttached)
            Debugger.Break();
        else
            throw(ex);
    }
}

这将为我提供用户单击的行的 RowHandle。我认为这就是您所追求的,但我不会为此使用鼠标按下事件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-03
    • 1970-01-01
    • 2016-05-30
    • 2010-10-31
    • 1970-01-01
    • 2013-08-20
    • 1970-01-01
    • 2021-11-27
    相关资源
    最近更新 更多