private
{ Private declarations }
procedure WMMOVE(var Msg: TMessage); message WM_MOVE;
procedure TForm1.WMMOVE(var Msg: TMessage);
begin
inherited;
if (Left < 30) and (Top < 30) and
(Left <> 0) and (Top <> 0) then // 设定移动到左上角 10 点范围内时贴到边上去
begin
Left := 0;
Top := 0;
Msg.Result := 0;
end;
end;
{
1.这个功能只在屏幕的左上角有效。
2.右上角
3.左下角右下角
4.2个窗体相互吸附
}