Entwickler-Ecke

Grafische Benutzeroberflächen (VCL & FireMonkey) - Formular verschieben


Moritz M. - Do 15.08.02 11:17
Titel: Formular verschieben
Hi Leute

Ich hab da mel ne Frage(was auch sonst...?):

Wie kann Ich es machen, dass wenn Der User im Formular auf ein bestimmtes Feld klickt dass dann das Formular der Maus bis zum nächsten klick über den Bildschirm folgt und dann stehen bleibt.
Im Klartext: Wie kann ich ein Formular verschieben lassen.

Und noch ne Frage:

Wie bekomme Ich die Aktuelle Position der Maus heraus?

Und wie bekomme Ich die Bildschirmauflösung raus?


Und schonmal danke an alle die mir bis jetzt hie im Forum geholfen haben...Ich habe viel gelernt :lol:

Cu

Mo


bigknaller - Do 15.08.02 11:24

Die Bildschirmauflösung bekommt man so raus:
Du fragst die Dimensionen des TScreen-Objekts ab

Quelltext
1:
2:
Horizontale_Aufloesung:=Screen.Width;
Vertikale_Aufloesung:=Screen.Height;


Moritz M. - Do 15.08.02 11:25
Titel: Thanks
Danke

Cu

Mo


lemming - Do 15.08.02 11:48


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:
34:
var
  XStart: Integer;
  YStart: Integer;
  Draging: Boolean;

procedure TMain.ZoneWindowMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  {Form Start Dragging}
  XStart := X;
  YStart := Y;
  Draging := True;
end;

procedure TMain.ZoneWindowMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  {Form Dragging}
  If Draging Then
  begin
    If X < XStart Then Main.Left := Main.Left - (XStart - X);
    If X > XStart Then Main.Left := Main.Left + (X - XStart);

    If Y < YStart Then Main.Top := Main.Top - (YStart - Y);
    If Y > YStart Then Main.Top := Main.Top + (Y - YStart);
  end;
end;

procedure TMain.ZoneWindowMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  {Form End Dragging}
  Draging := False;
end;


Main ist nichts anderes als Form1.
Bisschen unfeine Sache so mit globalen Variablen, abers tut :)


Moritz M. - Do 15.08.02 15:53
Titel: Danke
Danke!

Ist ja eigentlich logisch...finde ich

Mo