【问题标题】:Capture double click on a cell and get value for ComponentOne's C1FlexGrid捕获双击单元格并获取 ComponentOne 的 C1FlexGrid 的值
【发布时间】:2014-05-07 13:46:00
【问题描述】:

我有一个 C1FlexGrid 控件,并且该 C1Flexgrid 控件与某个数据源绑定,现在我想在单元格上双击事件时检索特定单元格的数据。有没有办法做到这一点?

我尝试使用

 c1FlexGridClassic1_DoubleClick()

但这并没有给我行号或任何值。

我使用CellbuttonClickEvent 尝试过这个,但我不想要这个。我希望它出现在 cellDoubleClick 事件中。

代码

public DataRow ReturnSelectedRow { get { return OrderDataRow; } } //This is property is used for transferring data to other form

private void c1FlexGrid1_CellButtonClick(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
{
    if (MessageBox.Show("Do you want to  select", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        MessageBox.Show("Selected purchase order" + c1FlexGrid1.Rows[e.Row][1]);
        OrderDataRow = OrderData.Rows[e.Row-1];
        this.Close();
    }
}

【问题讨论】:

  • 获取行号的代码是什么?请在此处粘贴代码

标签: c# .net winforms componentone c1flexgrid


【解决方案1】:

您是否阅读了flexgrid 的文档?

flexgrid有这么多各种作品的样本

这里是:

Flex Pdf Documentation

Flex Online Documentation

已编辑:

使用HitTest 查找单元格是否被双击

void c1FlexGrid1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        var ht = c1FlexGrid1.HitTest();

        if (ht.Row!=-1)
        {
            MessageBox.Show("Click on row no--" + ht.Row);
            //do something
        }
    }

【讨论】:

  • 是的,我在发布这个问题之前阅读了所有文档,但我没有找到任何解决方案
  • HitTest(e) 方法不接受参数 e 。错误发生无效参数
  • 哇,它有效,但我只使用HitTest()没有任何参数的方法var ht = c1FlexGrid1.HitTest();if (ht.Row!=-1){MessageBox.Show("Click on row no--" + ht.Row);}
猜你喜欢
  • 1970-01-01
  • 2022-06-17
  • 2013-05-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多