Autor Beitrag
christian_m
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Do 19.04.07 20:50 
Hi @ all!

Ich möchte ein Image mit der Maus ziehen (Drag/ OnMouseDown) und an die Stelle "fallen lassen" an der sich ein Shape befindet;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
If Drag Then Begin
  Image1.Top := Image1.Top+Y-StartY;
  Image1.Left := Image1.Left+X-StartX;
 end;
end;


procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 Drag := True;
 StartX := x;
 StartY := y;
end;


Ich habe folgendes Problem!:
Wie kann ich jetzt programmieren, dass das Image nur dann losgelasssen wird, wenn es auf diesem Shape ist?
Ich habs mal so probiert, geht aber net;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 if Image1.Top = Shape25.Top
  and Image1.Left = Shape25.Left

 Drag:= False;
 end;
end;


Ich hoffe mir kann jemand helfen!!

Danke im Voraus


edit// kann ich das mit ondragover verwirklichen ??
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 20.04.07 14:40 
Moin!

Du fragst doch nur einen Punkt ab, und keinen Bereich, deshalb würde das nur genau oben/links auf dem Shape klappen (so wie dein Code jetzt aussieht). :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Fr 20.04.07 15:01 
Und ausserdem fehlen die Klammern ;)

_________________
erare humanum est
christian_m Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 21.04.07 10:35 
Hi

hat sich erledigt; ich probiers anders