• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 588
  • Last Modified:

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...
0
gentlefox
Asked:
gentlefox
1 Solution
 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now