如何在WIndows窗体中的Datagridview的标题上禁用鼠标双击事件。 [英] How to disable Mouse Double Click event on the header of the Datagridview in WIndows Form.

查看:379
本文介绍了如何在WIndows窗体中的Datagridview的标题上禁用鼠标双击事件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的windows应用程序中有一个datagridview。当我双击datagridview行时,它工作正常,但是当我双击datagridview的标题时,该事件也会执行。请告诉我怎么可能我克服了这个问题。

Hi,I have a datagridview in my windows application.Well it works fine when i double clicks on the datagridview row but the event also execute when i double click on the header of the datagridview.Please suggest me how could i overcome from this issue.

提前谢谢。

推荐答案

在双击事件中你需要检查事件的原始来源是否为Row,如果没有,那么你可以避免它......

in the Double click event u need to check whehter the Original Source of the event is Row or not if not then u can avoid it...

 if (e.OriginalSource.GetType() == typeof(DataGridRow))
      {
        //Implement ur logic      
      }


希望它帮助你

hope it helps u


这篇关于如何在WIndows窗体中的Datagridview的标题上禁用鼠标双击事件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆