Notice
Recent Posts
Recent Comments
Link
승적이익강 (勝敵而益强)
[델파이]MDIChild Client Rect 변경 본문
in the OnCreate event place the following code:
where pnlMDI is a TPanel that can be placed anywhere on the form. This however is not enough. The MDIClient is moved and sized in TCustomForm.AlignControls which needs to be overridden to keep it occupying the whole panel it has been parented to. In the form's interface add the following code just before the "public" declaration:[Delphi]if ClientHandle <> 0 then Winapi.Windows.SetParent(ClientHandle, pnlMDI.Handle);
and in the implementation of AlignControls add the following code:[Delphi]protected procedure AlignControls(AControl: TControl; var Rect: TRect); override;
Note: this code isn't ideal. The inherited call moves the MDI Client and we are moving back immediately after, however we cannot get rid of this overhead without a major overhaul of the TClientForm code.[Delphi]procedure TYourForm.AlignControls(AControl: TControl; var Rect: TRect); var R: TRect; begin inherited AlignControls(AControl, Rect); if ClientHandle <> 0 then begin SetRect(Rect, 0, 0, pnlMDI.Width, pnlMDI.Height); with Rect do SetWindowPos(ClientHandle, HWND_BOTTOM, Left, Top, Right - Left, Bottom - Top, SWP_NOZORDER + SWP_NOACTIVATE); if FormStyle = fsMDIForm then if Winapi.Windows.GetClientRect(ClientHandle, R) then InvalidateRect(ClientHandle, nil, True); end; end;
'Delphi' 카테고리의 다른 글
[델파이] 초간단 Log 파일 (0) | 2016.05.04 |
---|---|
델파이 MDI 기초 (0) | 2016.05.04 |
[altibase] 델파이 ODBC, OLEDB 연결 (0) | 2016.05.04 |
Comments