Autor Beitrag
florian
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 30

Win XP Home
D5 Enterprise
BeitragVerfasst: Mi 27.08.03 16:57 
Hello eyerybody,

hab wieder mal ein problem:
wie kann ich ein Objekt(z.B. ein Label) auf einer Form mit einem MausKlick positionieren???

Hat hier irgendjemand eine Ahnugn, wie das geht?

ciao
florian

_________________
"640Kb should be enough for anybody." Bill Gates (in den 80'ern)
sCrAPt
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mi 27.08.03 17:29 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
label1.Left:=x;
label1.Top:=y;
end;
florian Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 30

Win XP Home
D5 Enterprise
BeitragVerfasst: Mi 27.08.03 18:38 
Titel: danke
Danke,
hatte es schon vorher rausgefunden:
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:
32:
33:
procedure TForm1.Label1DblClick(Sender: TObject);
begin
  moveable:=Sender;
  StatusBar1.SimpleText:=TWinControl(moveable).name;
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if Button=mbRight then
   begin
    moveable:=nil;
    StatusBar1.SimpleText:='Kein Objekt ausgwählt!';
   end
  else
 begin
 if moveable<>nil then begin
    TWinControl(moveable).left:=x;
    TWinControl(moveable).top:=y;
 end
else
StatusBar1.SimpleText:='Kein Objekt ausgwählt!';
end;
end;

procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button=mbRight then begin
  moveable:=nil;
  StatusBar1.SimpleText:='Kein Objekt ausgwählt!';
  end;
end;

_________________
"640Kb should be enough for anybody." Bill Gates (in den 80'ern)