Manuel Lopez-Michelone
asked on
draging and dropping dots around the canvas.
Hi guys,
Here is what I want to do: I have an array of dots (I know the coordinates X,Y of each dot), on the canvas of a window [in fact, I am working over a TImage]. I want to move these points around the canvas with the mouse. Any ideas to accomplish this task?
best regards
Manuel Lopez (lopem)
Here is what I want to do: I have an array of dots (I know the coordinates X,Y of each dot), on the canvas of a window [in fact, I am working over a TImage]. I want to move these points around the canvas with the mouse. Any ideas to accomplish this task?
best regards
Manuel Lopez (lopem)
ASKER
Dots can be just pixels that I write on canvas. Dots are declared as an array of coordinates[x,y]. Of course, they can be images or buttons. I mean, I just need some little points (imagine little red circles (2 pixel radius)) with the property of drag and drop.
Am I explaining to you?
best regards
Manuel Lopez (lopem)
Am I explaining to you?
best regards
Manuel Lopez (lopem)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops... Change the MouseDown one to this. Should use <3 rather than >3.
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
i: Integer;
begin
CurrentDot:=-1;
for i:= 0 to 9 do
begin
if (X-Dots[i].X<3) and
(X-Dots[i].X>-1) and
(Y-Dots[i].Y<3) and
(Y-Dots[i].Y>-1) then
begin
CurrentDot:=i;
end;
end;
end;
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
i: Integer;
begin
CurrentDot:=-1;
for i:= 0 to 9 do
begin
if (X-Dots[i].X<3) and
(X-Dots[i].X>-1) and
(Y-Dots[i].Y<3) and
(Y-Dots[i].Y>-1) then
begin
CurrentDot:=i;
end;
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What are the dots? Are they controls or do you draw them on the canvas?
How are the dots declared and how do you position them?