delphi如何防止MDI孩子最大化?

时间:2014-12-14 17:05:42

标签: delphi mdi childwindow maximize-window

在delphi mdi应用程序中,当使用

按下最大化按钮时,需要在Mainform客户区显示一个带有标题的子窗口
Win32Check(Windows.GetClientRect(ClientHandle, aTRect));

MDIChild1.BoundsRect := aTRect;

功能

那么,当按下最大化按钮时,我们如何阻止MDI子项最大化?

我已尝试使用

进行此操作
procedure TChildText.WMSYSCOMMAND(var Message: TWMSYSCOMMAND);
var
  aTRect:TRect;
begin
  inherited;
  case message.CmdType of
    SC_MAXIMIZE: 
      begin
        Win32Check(Windows.GetClientRect(MainForm.ClientHandle, aTRect));
        BoundsRect := aTRect;
      end;
  end;
end;

没有结果。

1 个答案:

答案 0 :(得分:1)

procedure TChildText.WMSYSCOMMAND(var Message: TWMSYSCOMMAND);
var
  aTRect:TRect;
begin
  if message.CmdType = SC_MAXIMIZE then
  begin
    Win32Check(Windows.GetClientRect(MainForm.ClientHandle, aTRect));
    BoundsRect := aTRect;
    message.CmdType := SC_RESTORE;
  end;
  inherited;
end;
相关问题