delphi 窗口跟随


本文整理自网络,侵删。

 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;

end.

相关阅读 >>

Delphi image1 图像旋转90

Delphi一个基于wininet的http操作小函数

Delphi 10 seattle中使用本地通知,请使用tnotificationcenter组件

Delphi 实现关闭指定进程,自身防杀

Delphi 根据字符串找到函数并执行

Delphi 得到字符串拼音首字母

Delphi shellexecute最简单的结束进程代码

Delphi windows 编程[18] - 更换菜单项: modifymenu

Delphi pascal 单元文件的特殊定义格式

Delphi 通过http获取软件版本

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...