怎么让子窗体只最大化到父窗体边缘,如delphi7最大化其代码编辑窗体一样

如何让子窗体只最大化到父窗体边缘,如delphi7最大化其代码编辑窗体一样
如何让子窗体只最大化到父窗体边缘,如delphi7最大化其代码编辑窗体一样

给点思想!

------解决方案--------------------
首先我们假设你已经知道主窗体的位置了。

那么在子窗体中加入一个对WM_GETMINMAXINFO消息的处理。

比如在form的public中增加:
procedure FormMax(var MinMaxMessage: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;

对应的代码:
procedure TForm1.FormMax(var MinMaxMessage: TWMGetMinMaxInfo);
begin
inherited;

//只要在这里设置窗体的大小限制和位置就行了。
MinMaxMessage.MinMaxInfo.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

end;

相关的定义
tagMINMAXINFO = packed record
ptReserved: TPoint;
ptMaxSize: TPoint;
ptMaxPosition: TPoint;
ptMinTrackSize: TPoint;
ptMaxTrackSize: TPoint;
end;

直接粘Help了,很简单,你应该能看懂。
ptReserved

Reserved; do not use.

ptMaxSize

Specifies the maximized width (point.x) and the maximized height (point.y) of the window.

ptMaxPosition

Specifies the position of the left side of the maximized window (point.x) and the position of the top of the maximized window (point.y).

ptMinTrackSize

Specifies the minimum tracking width (point.x) and the minimum tracking height (point.y) of the window.

ptMaxTrackSize

Specifies the maximum tracking width (point.x) and the maximum tracking height (point.y) of the window.
------解决方案--------------------
form2.Align:=alClient;