Autor Beitrag
Daviho
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Di 14.09.04 19:08 
Hi

Ich habe ein Problem und zwar möchte ich einen Label während der Laufzeit auf ein Image verschieben.
Aber wie?

Schonmal im Vorraus danke für alles Antworten

mfg

Daviho
Johannes Maier
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 173

Win XP
D7 Prof
BeitragVerfasst: Di 14.09.04 20:34 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
TForm1.Button1Click(Sender: TObject);
begin
  Label1.Left := Image1.Left + 50;  //irgendwas im Image festlegen
  Label1.Top := Image1.Top + 50;  //auch irgendwas festlegen ;)
end;


So geht es, wenn es auf Knopfdruck passiert ...
Ansonsten kannst du es sicher mit Drag & Drop machen, oder selbst definieren, was passiert, wenn du aus das Label die Maus drückst, bewegst und wieder loslässt ;) So genau kenn ich mich damit nicht aus :)

_________________
MfG
Johannes ehem. jbmaier
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mi 15.09.04 08:24 
is zwar net schön aber funktioniert *G*:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
var
  Form1: TForm1;
  drag: boolean;

implementation

{$R *.dfm}

procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 drag:=true;
end;

procedure TForm1.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
 if drag then
 begin
  label1.Top:=Mouse.CursorPos.Y-Form1.Top;
  label1.Left:=Mouse.CursorPos.X-Form1.Left;
 end
end;

procedure TForm1.Label1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  drag:=false;
end;

end.

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: So 19.09.04 18:56 
Eine andere Möglichkeit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
const sc_dragmove = $f012;
begin
  ReleaseCapture;
  TWinControl(Label1).perform(wm_syscommand,sc_dragmove, 0);
end;