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
close icon

Cursor Position on Drag and Drop

Hi, I would like the cursor position to follow the mouse pointer position as the user drags an item to drop onto the editor control. Currently I use: ((EditControl)sender).CurrentPosition = ((EditControl)sender).PointToVirtualPosition(this.PointToClient(new Point(e.X , e.Y))); In the drag over event, and it works ok but it seems to be offset by an amount as the cursor is always below the mouse pointers position. I was wanting to know if I need to add an offset in, or am I using the right methods to translate the point to get this to follow the point of the mouse cursor? Thanks In Advance Graeme

3 Replies

AD Administrator Syncfusion Team August 13, 2005 01:17 AM UTC

Hi Graeme, Try the following code instead and let me know if this workd for you : Point virtualPoint = this.editControl1.PointToVirtualPosition(Control.MousePosition); this.editControl1.CurrentPosition = virtualPoint; this.editControl1.InsertText(this.editControl1.CurrentPosition.X, this.editControl1.CurrentPosition.Y, text); Let me know if this works for you. We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


GF Graeme Finn August 16, 2005 06:00 AM UTC

Guru, Thanks but that didn''t fix my problem. However I did find the solution to my problem. So i''m just posting it here for completeness as someone else might need it: Point mousePoint = Control.MousePosition; mousePoint.Offset(0, -Cursor.Size.Height); Point virtualPoint = ((EditControl)sender).PointToVirtualPosition(this.PointToClient(mousePoint)); ((EditControl)sender).CurrentPosition = virtualPoint; Cheers, Graeme


AD Administrator Syncfusion Team August 16, 2005 01:48 PM UTC

Hi Graeme, Thanks for sharing this information with us. We are glad that this issue is resolved. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon