本文整理自网络,侵删。
private { Private declarations } Procedure OnMove(Var Message:TMessage); Message WM_MOVE; public { Public declarations } end;
Procedure TForm_Main.OnMove(Var Message:TMessage);begin If GetWindowRect(Form_Main.Handle, lpRect) And (Metrics.X > 0) And (Metrics.Y > 0) Then begin if lpRect.Left < 30 then begin Form_Main.Left := 0 - (Form_Main.Width - 10); //左隐藏 end Else if (Metrics.X - lpRect.Right) < 30 then begin Form_Main.Left := Metrics.X - 10; //又隐藏 end Else if lpRect.Top < 30 then begin Form_Main.Top := 0 - (Form_Main.Height - 10); //上隐藏 end Else if (Metrics.Y - lpRect.Bottom) < 30 then begin //下隐藏 Form_Main.Top := Metrics.Y - 60; end; end;end;
来源:https://www.7xcode.com/archives/93.html
相关阅读 >>
Delphi 移动windows开始按钮到任务栏中的任何位置
更多相关阅读请进入《Delphi》频道 >>