Page 1 of 1

Mouse dragging

Posted: Saturday 26th November 2022 4:38pm
by cogier
When I drag an image on the screen the mouse is positioned top left just outside the image. Is there a way to get the mouse cursor to be within the image being dragged?

Re: Mouse dragging

Posted: Sunday 27th November 2022 12:22am
by BruceSteers
Before calling the object.Drag() method you set Drag.IconX
Drag.IconY

I used this..
Public sub MyObject_MouseMove()
If Mouse.Left then
Drag.IconX = Mouse.ScreenX - Last.ScreenX
Drag.IconY = Mouse.ScreenY - Last.ScreenY
Drag.Icon = hDragPicture
Last.Drag(sData, "text/plain")
Endif
End


That made the mouse stay in the position it was at when the object was clicked.

Re: Mouse dragging

Posted: Sunday 27th November 2022 3:39pm
by cogier
Thanks Bruce, that did the trick. I had tried the IconX and IconY but couldn't get them to work as I put them in the wrong place.