Link to home
Start Free TrialLog in
Avatar of Manuel Lopez-Michelone
Manuel Lopez-MicheloneFlag for Mexico

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)
Avatar of paulb1989
paulb1989

Could you tell me more?

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?
Avatar of Manuel Lopez-Michelone

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)
SOLUTION
Avatar of paulb1989
paulb1989

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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;
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial