27 de out. de 2011

como impedir que o form seja arrastado para fora da margem da tela

private
  procedure WMMove(var Msg: TWMMove); message WM_MOVE;

procedure TForm1.WMMove(var Msg: TWMMove); 
begin
  if Left < 0 then
    Left := 0;
  if Top < 0 then
    Top := 0;
  if Screen.Width - (Left + Width) < 0 then
    Left := Screen.Width - Width;
  if Screen.Height - (Top + Height) < 0 then
    Top := Screen.Height - Height;
end;

Nenhum comentário:

Postar um comentário