首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Janus GridEX:如果标题被点击,则查找

Janus GridEX:如果标题被点击,则查找
EN

Stack Overflow用户
提问于 2016-06-01 17:23:05
回答 2查看 1.2K关注 0票数 1

目前,当我双击任何网格项目时,下面的事件都会被触发。这包括如果我也双击标题。

有没有一种方法可以区分单击的标题或行?SelectedItem位置始终大于0

代码语言:javascript
复制
this.grdItems = new Janus.Windows.GridEX.GridEX();
...
this.grdItems.DoubleClick += new System.EventHandler(this.grdItems_DoubleClick);

private void grdItems_DoubleClick(object sender, System.EventArgs e)
    { 
        if (grdItems.SelectedItems!=null && grdItems.SelectedItems[0].Position >= 0)
        {
          //doing something
        }
    }
EN

回答 2

Stack Overflow用户

发布于 2016-09-26 15:36:56

一种方法是使用HitTest()方法

声明你的变量

代码语言:javascript
复制
public int MLastX { get; set; }
public int MLastY { get; set; }

有一种方法可以捕获最后一次鼠标单击的坐标

代码语言:javascript
复制
/// <summary>
/// Handles the MouseDown event of the grdSearch control. On a mousedown the click co-ordinates
///  is set.  This method is used to determine whether you have clicked on a gridrow cell in the method above
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
private void grdSearch_MouseDown(object sender, MouseEventArgs e)
{
    MLastX = e.X;
    MLastY = e.Y;
}

检查该单击是否在单元格中

代码语言:javascript
复制
//check whether you have clicked in a cell 
if (grdSearch.HitTest(MLastX, MLastY) == GridArea.Cell)
{
   //now only execute the rest
}
票数 0
EN

Stack Overflow用户

发布于 2019-08-04 21:36:17

代码语言:javascript
复制
private void mxGridExJanus1_RowDoubleClick(object sender, Janus.Windows.GridEX.RowActionEventArgs e)
{
    if (e.Row.RowType != RowType.Record) return;

    // row clicked
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37564497

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档