Autor Beitrag
McFarlane
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

WIN XP Prof.
Delphi 2005 PE, Turbo Delphi 2006, PHP (Eclipse)
BeitragVerfasst: Di 20.02.07 18:51 
Hallo,
ich hab hier ein Fenster (ohne Rand und allem), welches ich bewegen will.
Zur Zeit hab ichs so gemacht: Einmal klicken und das Fenster folgt der Maus, nochmal klicken um es wieder loszulassen.
Wie kann ich es aber machen, damit ich es mit gedrückter Maustaste ziehe? (Das was ich versucht hab endete nur inner Endlosschleife...)

Hier ist der QText des bisherigen Programmes:

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:
34:
35:
36:
37:
38:
var
  mx,my: integer;
  tmove: TTimer;

procedure Tmf.move(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var ini : Tinifile;
begin

  if (Button = mbleft) AND (alarming = false)
  then begin
    if tmove.enabled=true
    then begin
      tmove.enabled := false;
      ini := TIniFile.Create(ExtractFilePath(Application.exename) + 'config.ini');
      try
        ini.WriteString('Position','X',IntToStr(mf.left));
        ini.WriteString('Position','Y',IntToStr(mf.Top));
      finally
        ini.Free;
      end;
    end
    else begin
      mx := X;
      my := Y;
      tmove.enabled := true;
    end;
  end;

end;

procedure Tmf.moveit(Sender: TObject); //OnTimer ereignis von Tmove
var maus : TPoint;
begin
  maus := mouse.CursorPos;
  mf.Left := maus.X - mx;
  mf.Top := maus.Y - my;
end;


Hoffe, ihr könnt mir helfen. McFarlane

_________________
21 ist nur die halbe Wahrheit...
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Di 20.02.07 18:56 

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
McFarlane Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

WIN XP Prof.
Delphi 2005 PE, Turbo Delphi 2006, PHP (Eclipse)
BeitragVerfasst: Di 20.02.07 19:18 
OK, danke.

_________________
21 ist nur die halbe Wahrheit...