DEV GridView How to capture row double-click events

Source: Internet
Author: User
private void Viewhtlb_mousedown (object sender, MouseEventArgs e)  
       {  
           if (E.button = = MouseButtons.Left && E.clicks = = 2)//Determine if the mouse is double-clicked with the  
               DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo ghi = Viewhtlb.calchitinfo (New Point (e.x, e.y));  
               if (Ghi. Inrow)  //judge whether the cursor is    
               in  
                   the row {MessageBox.Show ("already double-clicked!"). ");  
               }  
           }    
       }

Add the location of the modification method:

Then the method and

private void Grid1_doubleclick (object sender, EventArgs e)

What difference does it have?

The Grid1_doubleclick (object sender, EventArgs e) function captures the entire grid's double-click event, not just the list row event, for example: you double-click the header, the white space below the list to display the data, and it triggers the grid1_ The DoubleClick (object sender, EventArgs e) function, while the Viewhtlb_mousedown (object sender, MouseEventArgs e) function is not activated at this time.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.