procedure WMWindowPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;
procedure TFmBack.WMWindowPosChanging(var Message: TWMWindowPosChanging);
begin
inherited;
if (Message.WindowPos.y + Message.WindowPos.cy > Screen.WorkAreaHeight) then begin
Message.WindowPos.Y := Screen.WorkAreaHeight - Height ;
end;
if (Message.WindowPos.x + Message.WindowPos.cx > Screen.WorkAreaWidth) then begin
Message.WindowPos.X := Screen.WorkAreaWidth - Width ;
end;
if Message.WindowPos.x < 0 then
Message.WindowPos.x := 0;
if Message.WindowPos.y < 0 then
Message.WindowPos.y := 0;
end;
窗体锁定在屏幕内 不可超出桌面屏幕边缘
最新推荐文章于 2022-11-24 03:41:57 发布