Einzelnen Beitrag anzeigen

striderx

Registriert seit: 11. Feb 2007
Ort: Bergisch Gladbach
206 Beiträge
 
Delphi 10.4 Sydney
 
#22

AW: Form über anderer Form zentrieren [gelöst]

  Alt 1. Mär 2017, 07:43
So, ich habe jetzt eine Lösung gefunden:

Die aufrufende Form läßt sich über Screen.Forms[0] ermitteln.

Das Ganze sieht bei mir dann so aus:

Delphi-Quellcode:
  aCaller := Screen.Forms[0];
  if aCaller <> Nil then begin
     dlgShowMsg.Position := poDesigned;
     dlgShowMsg.Top := aCaller.Top + Trunc((aCaller.Height - dlgShowMsg.Height) / 2);
     dlgShowMsg.Left := aCaller.Left + Trunc((aCaller.Width - dlgShowMsg.Width) / 2);
  end
  else dlgShowMsg.Position := poOwnerFormCenter;
  Mit Zitat antworten Zitat