<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Il 13/04/2018 02:40, Donald Ziesig via Lazarus ha scritto:<br>
</p>
<blockquote type="cite"
cite="mid:b622088d-41b7-7bfc-9165-a1d9672b6eb0@ziesig.org">
<p>You're right. It gets <b>close</b> but not quite there. I
can move the control so long as the mouse is <b>not</b> over
the control while it is moving <span class="moz-smiley-s2"><span>:-(</span></span>.
I will look at this closer in the morning and see if I can work
around it (or if there is something I am missing).</p>
</blockquote>
<br>
You might find useful, as a guideline, the code I'm using in one of
my application to drag a button so that it doesn't cover the useful
part of an image. Just using the OnMouseDown, OnMouseMove and
OnMouseUp of your TImage, and getting rid of the code you don't
need, to perform an extra action on OnMouseUp, you should be able to
do the trick.<br>
<br>
<blockquote type="cite"> TErrForm = class(TForm)<br>
......<br>
protected<br>
ResetDragged: Boolean;<br>
CursorPos: TPoint;<br>
ObjectPos: TPoint;<br>
....<br>
<br>
procedure TErrForm.ResetBtnMouseDown(Sender: TObject; Button:
TMouseButton;<br>
Shift: TShiftState; X: LongInt; Y: LongInt);<br>
begin<br>
ResetDragged := True;<br>
CursorPos.X := Mouse.CursorPos.X;<br>
CursorPos.Y := Mouse.CursorPos.Y;<br>
with ResetBtn do begin;<br>
ObjectPos.X := Left;<br>
ObjectPos.Y := Top;<br>
end;<br>
end;<br>
<br>
procedure TErrForm.ResetBtnMouseMove(Sender: TObject; Shift:
TShiftState;<br>
X: LongInt; Y: LongInt);<br>
begin<br>
if ResetDragged then begin<br>
with ResetBtn do begin<br>
Left := ObjectPos.X + (Mouse.CursorPos.X - CursorPos.X);<br>
Top := ObjectPos.Y + (Mouse.CursorPos.Y - CursorPos.Y);<br>
ResetPos.X := (Left * NormalGeometry.ClientWidth div
CurrImage.Width) + HorzScrollBar.Position;<br>
ResetPos.Y := (Top * NormalGeometry.ClientHeight div
CurrImage.Height) + VertScrollBar.Position;<br>
end;<br>
end;<br>
end;<br>
<br>
procedure TErrForm.ResetBtnMouseUp(Sender: TObject; Button:
TMouseButton;<br>
Shift: TShiftState; X: LongInt; Y: LongInt);<br>
begin<br>
if ResetDragged then begin<br>
ResetDragged := False;<br>
Paint;<br>
end;<br>
if (abs(Mouse.CursorPos.X - CursorPos.X) < 10) and
(abs(Mouse.CursorPos.Y - CursorPos.Y)< 10) then Close;<br>
end;<br>
</blockquote>
<br>
Hope that it helps.<br>
<br>
Giuliano<br>
<br>
</body>
</html>