суббота, 27 апреля 2013 г.

Ещё правки VCL (14)


procedure TCustomForm.WMSysCommand(var Message: TWMSysCommand);

 function IsMDIMaximized: Boolean;
  var
    I: Integer;
  begin
   with Application.MainForm do
    for I := 0 to Pred(MDIChildCount) do
     if MDIChildren[I].WindowState = wsMaximized then
     begin
      Result := True;
      Exit;
     end;
   Result := False;
  end;

 procedure RealignMDIChildren;
  var
    I: Integer;
  begin
   with Application.MainForm do
    for I := 0 to Pred(MDIChildCount) do
     if MDIChildren[I] <> Self then
      MDIChildren[I].Realign;
  end;
var
 lMaximizedMDIChild : boolean;
begin
  lMaximizedMDIChild := (FormStyle = fsMDIChild) and IsMDIMaximized;
  with Message do
  begin
    if (CmdType and $FFF0 = SC_MINIMIZE) and (Application.MainForm = Self) then
      Application.WndProc(TMessage(Message))
    else if (CmdType and $FFF0 <> SC_MOVE) or (csDesigning in ComponentState) or
      (Align = alNone) or (WindowState = wsMinimized) then
      inherited;
    if ((CmdType and $FFF0 = SC_MINIMIZE) or (CmdType and $FFF0 = SC_RESTORE)) and
      not (csDesigning in ComponentState) then
    begin
     if (Align <> alNone) then
      RequestAlign;
     if lMaximizedMDIChild then  {V}
      RealignMDIChildren;        {V}
    end;
  end;
end;

Комментариев нет:

Отправить комментарий