Einzelnen Beitrag anzeigen

a.def
(Gast)

n/a Beiträge
 
#7

AW: Formular Position speichern, Generell wenn geschlossen wird oder bei ModalResult

  Alt 25. Jan 2017, 12:41
Guck mal hier. So kann man auch auf außerhalb-des-sichtbaren-Bereichs prüfen.

Delphi-Quellcode:
procedure checkFormPosition(aFormToSetPos: TForm);
begin
 if Screen.MonitorFromWindow(aFormToSetPos.Handle, mdNull) = nil then
  begin
   // Form is outside of any monitor. Move to center of main monitor
   aFormToSetPos.Top := (Screen.Monitors[0].Height - aFormToSetPos.Height) div 2;
   aFormToSetPos.Left := (Screen.Monitors[0].Width - aFormToSetPos.Width) div 2;
  end;
end;
  Mit Zitat antworten Zitat