mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 23:39:24 +02:00
lcl: fix position for poMainFormCenter. Issue #29887
git-svn-id: trunk@52043 -
This commit is contained in:
parent
f8a7a5fe4d
commit
65e40fa6a8
@ -1270,7 +1270,8 @@ var
|
||||
X, Y: integer;
|
||||
p: TPosition;
|
||||
AForm: TCustomForm;
|
||||
RealRect: TRect;
|
||||
RealRect, AFormRealRect: TRect;
|
||||
AFormRealWidth, AFormRealHeight: Integer;
|
||||
begin
|
||||
if (Parent <> nil) or (ParentWindow <> 0) then exit;
|
||||
|
||||
@ -1323,8 +1324,17 @@ begin
|
||||
Y := (AForm.ClientHeight - RealHeight) div 2;
|
||||
end else
|
||||
begin
|
||||
X := ((AForm.Width - RealWidth) div 2) + AForm.Left;
|
||||
Y := ((AForm.Height - RealHeight) div 2) + AForm.Top;
|
||||
if AForm.HandleAllocated and (GetWindowRect(AForm.Handle, AFormRealRect) <> 0) then
|
||||
begin // success
|
||||
AFormRealWidth := AFormRealRect.Right-AFormRealRect.Left;
|
||||
AFormRealHeight := AFormRealRect.Bottom-AFormRealRect.Top;
|
||||
end else
|
||||
begin // error
|
||||
AFormRealWidth := AForm.Width;
|
||||
AFormRealHeight := AForm.Height;
|
||||
end;
|
||||
X := ((AFormRealWidth - RealWidth) div 2) + AForm.Left;
|
||||
Y := ((AFormRealHeight - RealHeight) div 2) + AForm.Top;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user