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/