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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting a cell''s boundaries (rectangle)

Thread ID:





18173 Aug 25,2004 11:29 AM UTC Aug 25,2004 06:15 PM UTC WinForms 3
Tags: GridControl
Doug Lind
Asked On August 25, 2004 11:29 AM UTC

Hi, I am using OLE D&D to implement row dragging within a GDBG and would like to emulate the drop target indicator, used on a default row/column drag. My intent is to draw the drop target indicator from the MouseMove event. Is there a way to get a cells boundaries, relative to the grid? Are there any hooks in the cell model I can use? I''ve tried the example referred to in the Windows FAQ but the point at which the event triggers varies with mouse speed so I end up with drop targets in the middle of a cell. Thanks, Doug

Administrator [Syncfusion]
Replied On August 25, 2004 12:21 PM UTC

If you are in the grid''s mousedown event, I think you can use code like this to get the cell rectangle.
int row, col;
Point pt = new Point(e.X, e.Y);
if(this.gridDataBoundGrid1.PointToRowCol(pt, out row, out col, -1))
	Rectangle cellRect = this.gridDataBoundGrid1.RangeInfoToRectangle(GridRangeInfo.Cell(row, col));

Doug Lind
Replied On August 25, 2004 06:05 PM UTC

Thanks that worked great! Now that I can paint a line on the cell, how do I remove it. It seems like a refresh, refreshRange or invalidate would work but it does not occur. It may be that I am firing the refresh event from within a mousemove event, with a mouse button down (i.e. dragging). The code executes the call but nothing happens until the button is released. Is there a way to force the cell to repaint itself? Would being in drag mode have anything to do with it? Doug

Administrator [Syncfusion]
Replied On August 25, 2004 06:15 PM UTC

Here is a forum thread that shows a minimal sample to drawing feedback as you drag. Maybe that will give you some ideas. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=10611 Here is another forum thread that has a sample using a DragHelper class in our library code. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=3815


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon