当前位置: 主页>网吧程序>

delphi程序窗口跟随

时间:2011-06-24 17:50来源:www.58un.net 作者:网吧联盟
  unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
protected
procedure WMMove(var Message: TWMMove); message WM_MOVE;

private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}
var a,b: Integer;

procedure TForm1.WMMove(var Message: TWMMove);
begin
if Assigned(Form2) then
begin
Form2.Left := Left + a;
Form2.Top := Top + b;
end;
inherited;
end;


procedure TForm1.FormShow(Sender: TObject);
begin
Form2.Show;
Form2.Left := Left+Width;
Form2.Top := Top;
a := Form2.Left - Left;
b := Form2.Top - Top;
end;
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------