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.

GridHitTestContext

Thread ID:

Created:

Updated:

Platform:

Replies:

20362 Oct 15,2004 12:49 AM Oct 15,2004 03:07 AM Windows Forms 6
loading
Tags: GridControl
Louis
Asked On October 15, 2004 12:49 AM

Hi, Would you have some code snippet which shows how to know if the mouse is over a cell, a header cell, ... in a grid control. Thank''s in advance Louis

Administrator [Syncfusion]
Replied On October 15, 2004 12:58 AM

Here is code that gives you the row and col index of the hit. From there you would compare these values against grid.Cols.HeaderCount or grid.Rows.HeaderCount to decide whether the cell was a header or not. //get the point somehow //could possible use event args here //but make sure the point is in the grid''s coordinates Point pt = grid.PointToClient(Control.MousePosition); if(grid.PointToRowCol(pt, out row, out col, -1)) { // row and col now hold their values }

Louis
Replied On October 15, 2004 01:28 AM

In fact I''m moving from MSDATAGRID and I''d like to be able to test against the same type than DataGrid.HitTestType. Especially RowResize and ColumnResize. >Here is code that gives you the row and col index of the hit. From there you would compare these values against grid.Cols.HeaderCount or grid.Rows.HeaderCount to decide whether the cell was a header or not. > > >//get the point somehow >//could possible use event args here >//but make sure the point is in the grid''s coordinates >Point pt = grid.PointToClient(Control.MousePosition); >if(grid.PointToRowCol(pt, out row, out col, -1)) >{ >// row and col now hold their values >} >

Administrator [Syncfusion]
Replied On October 15, 2004 02:05 AM

This forum is for support of our Essential Grid products.

Louis
Replied On October 15, 2004 02:26 AM

Sorry if I''m not clear. I''m effectively working with Essential Grid products. As I tried to explain I can''t see how to know on which part of the grid the mouse is. For example if the mouse is over a horizontal grid line between headers or if the mouse is over a vertical grid line between headers... Thank''s for your reply Louis

Administrator [Syncfusion]
Replied On October 15, 2004 02:35 AM

I am sorry. The above code can tell you when you are over particular cells. If you want to know when you are sizing a column or row, you can handle the ResizingColumns and ResizingRows events. The evernt args has much information about what is happen including a Reason property.

Louis
Replied On October 15, 2004 03:07 AM

That''s fine, Thank''s a lot Louis >I am sorry. > >The above code can tell you when you are over particular cells. > >If you want to know when you are sizing a column or row, you can handle the ResizingColumns and ResizingRows events. The evernt args has much information about what is happen including a Reason property.

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.

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.

;