We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Obtaining column header from right mouse click

Thread ID:

Created:

Updated:

Platform:

Replies:

59077 Apr 4,2007 03:36 PM UTC Apr 4,2007 06:04 PM UTC WinForms 2
loading
Tags: GridControl
Thomas Pang
Asked On April 4, 2007 03:36 PM UTC

We are trying to obtain the column header cell from a right mouse click to popup a context menu. Unfortunately the Current Cell property does not reflect the selected header.


haneefm [Syncfusion]
Replied On April 4, 2007 03:43 PM UTC

Hi Thomas,

Here is code that catches a mousedown event and tests to see if it is a right-click on a header.

private void gridDataBoundGrid1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
Point clickPoint = gridDataBoundGrid1.PointToClient(Cursor.Position);
int rowIndex, colIndex;
gridDataBoundGrid1.PointToRowCol(clickPoint, out rowIndex, out colIndex);
if(rowIndex == 0 && colIndex > 0)
MessageBox.Show("gridDataBoundGrid1_MouseDown");
}
}

Best regards,
Haneef

Thomas Pang
Replied On April 4, 2007 06:04 PM UTC

Thank you for this.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;