Maximize a fsMDIChild to fit perfecly in the fsMDIForm

I'm using    

procedure TForm1.WMSysCommand(var msg: TWMSyscommand);
  begin
  If (msg.CmdType and $FFF0) = SC_MAXIMIZE Then
  Begin
    // set Panel's bounds

   (Code needed Here... by an expert)

  End
  Else
    inherited;
end;

I want to find the best way to get the exact size in the fsMDIForm Client left area to fit perfectly my maximized form without loosing my form border and icons.  Regardless if a put a menu, status bar, Group container, tree view, etc..

I know it's poosible because when i do a tile horizontal it's the result I'm looking for.  I can't use this fucntion because when i have 2 MDIChilds form, I still want my 2 MDIChilds over eatch other with the same size.

Thanks You Experts...
gentlefoxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

robert_marquardtCommented:
If you have only one MDI child window and want it to cover the MDI client area without being maximized then
simply do an tile vertically or tile horizontally.
0
gentlefoxAuthor Commented:
No because i have 3 MDIChilds that will overlap eatch other.  That's why i want to really do it manualy...
0
mokuleCommented:
Hi,
You can start with something like this

procedure TForm1.ToolButton2Click(Sender: TObject);
var
  i: integer;
  l,t,r,b: integer;
begin
  l := 0;
  t := 0;
  r := ClientWidth;
  b := ClientHeight;
  for i := 0 to ControlCount - 1 do
    begin
    if Controls[i].Visible then
      case Controls[i].Align of
        alLeft:
          begin
          if Controls[i].Left + Controls[i].Width > l then
            l := Controls[i].Left + Controls[i].Width;
          end;
        alTop:
          begin
          if Controls[i].Top + Controls[i].Height > t then
            t := Controls[i].Top + Controls[i].Height;
          end;
        alBottom:
          begin
          if Controls[i].Top < b then
            b := Controls[i].Top;
          end;
        alRight:
          begin
          if Controls[i].Left < r then
            r := Controls[i].Left;
          end;
        end;
    end;
  ActiveMDIChild.SetBounds(0,0,r-l-4,b-t-4); // should be something wiser then 4 I think
end;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.