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.
Syncfusion Feedback

Cursor Position on Drag and Drop

Thread ID:

Created:

Updated:

Platform:

Replies:

33071 Aug 12,2005 07:03 AM UTC Aug 16,2005 01:48 PM UTC Windows Forms 3
loading
Tags: EditControl
Graeme Finn
Asked On August 12, 2005 07:03 AM UTC

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

Administrator [Syncfusion]
Replied On 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.

Graeme Finn
Replied On 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

Administrator [Syncfusion]
Replied On 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.

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

;