请问各位大哥,窗体的什么事件触发窗体的移动位置变化
也就是窗体的Form.left变了,即产生相应事件
我试过了Form的所有事件,可都不能产生相应的效果
请问各位大哥有没办法帮忙解决啊?
或者写个函数就可以实现还是???

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Edit1: TEdit;
      private
        { Private declarations }
      public
        { Public declarations }
        procedure WMMOVE(var msg:TMessage); message WM_MOVE;
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMMOVE(var msg: TMessage);
    begin
      Edit1.Text:=('x:'+inttostr(msg.LParamLo)+'y:'+inttostr(msg.LParamHi));
    end;end.
      

  2.   

    可以重载窗口的WndProc消息,然后拦截WM_MOVE消息:
    protected
        procedure WndProc(var Message: TMessage); override;
    实现代码:
    procedure TForm1.WndProc(var Message: TMessage);
    begin
      if (Message.Msg = WM_MOVE) then
        ShowMessage('Window is moved!');
      inherited;
    end;