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.
Unfortunately, activation email could not send to your email. Please try again.

Obtaining column header from right mouse click

Thread ID:





59077 Apr 4,2007 11:36 AM Apr 4,2007 02:04 PM Windows Forms 2
Tags: GridControl
Thomas Pang
Asked On April 4, 2007 11:36 AM

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 11:43 AM

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)

Best regards,

Thomas Pang
Replied On April 4, 2007 02:04 PM

Thank you for this.


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.

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.