c1flexgrid 通过 HitTestInfo 根据坐标 取得所在行

c1flexgrid 通过 HitTestInfo 根据坐标 取得所在行

 

 1         private void c1FlexGrid1_Click(object sender, EventArgs e)
 2         {
 3             MouseEventArgs mouseEvent = e as MouseEventArgs;
 4             if (mouseEvent.Button == MouseButtons.Left)
 5             {
 6                 if (c1FlexGrid1.Rows != null && c1FlexGrid1.Rows[c1FlexGrid1.RowSel]["YN"] != null &&  c1FlexGrid1.RowSel > 0 )
 7                 {
 8                     HitTestInfo hti = c1FlexGrid1.HitTest(mouseEvent.Location);
 9                     int currentRowIndex = hti.Row; // 也可以通过 c1FlexGrid1.RowSel,但是这个当你在点击空白处的时候,还是取得之前的停留的焦点行列信息
10                     string ynValue = c1FlexGrid1.Rows[currentRowIndex]["YN"].ToString().Trim();
11                     if (ynValue == "1")
12                     {
13                         ynValue = "0";
14                     }
15                     else
16                     {
17                         ynValue = "1";
18                     }
19 
20                     c1FlexGrid1.Rows[currentRowIndex]["YN"] = ynValue;
21                 }
22             }
23         }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值