There is the good component to maximize a child window in a client area (the SHIFT key must be held) - NLDExtraMDIProps.
Or this code can be used:
procedure WMSIZE(var Msg: TMessage); message WM_SIZE;
procedure TForm2.WMSIZE(var Msg: TMessage);
begin
inherited;
if Msg.WParam = SIZE_MAXIMIZED then
begin
ShowWindow(Handle, SW_RESTORE);
Left := 0;
Top := 0;
Width := Form1.ClientWidth - 4; // The BORDER
Height := Form1.ClientHeight - 4;
end;
end;
But maximizing isn't real maximizing. The child window is only aligned to the client area. It must automatically resize and fit the client area when the parent window is resized, the maximize/restore system button must change etc.
I try to accomplish effects that are described below.
As you see on the pictures the child windows are maximized, and
they don't take the entire parent window (only the client area).
It's impossible to move them over the caption/title bar because they are maximized.
They have the restore button, not the maximize button any more.
They are aligned to the client area (resizing of the parent window causes resizing of the child one withing the client area).
The code in my question and the component don't do like the child windows on the pictures.
Can we make a window really maximized (not just aligned)?
Not maximized (not good; the component and the code from my question maximize like on these pictures):
Maximized (what I need):