Hi,
I currently work on an application - under MS WINDOWS - that creates a secondary Form/Window, on demand.
I want this Form/Window to move to the right of the screen, and resize to full screen height.
Since I switched on the "Hi DPI" feature it didn't behave as expected.
When resizing the secondary window in FormShow(Sender: TObject)
it got too large and bottom (and right) was outside the screen
( .. in case, Windows' Scaling is > 100% ).
Now I discovered again the "AfterShow" solution ..
=>
https://www.swissdelphicenter.ch/de/showcode.php?id=1276Now, when calling
PostMessage( Self.Handle, WM_AFTER_SHOW, 0, 0);
in FormShow()
=>
procedure TSecondaryForm.WmAfterShow(var Msg: aMessage); //message WM_AFTER_SHOW;
var
rNew : TRect;
r : TRect;
begin
GetWindowRect( FindWindow( 'Shell_traywnd', ''), r);
// needs JWAwindows in "uses"
rNew.Top:= 0;
rNew.Left:= Screen.Width -Self.Width -1;
rNew.Right:= Screen.Width -1;
rNew.Bottom:= r.Top -48;
Self.BoundsRect:= rNew
end;
it much better fits to screen. Yeah !
Could this be called a "bug" or design error that the scaling of the window - with Hi DPI -
(for example 125%) to the Screen Resolution
does happen after FormShow ?