求解:MDI最小化问题(50分)

  • 主题发起人 主题发起人 dyb_23
  • 开始时间 开始时间
D

dyb_23

Unregistered / Unconfirmed
GUEST, unregistred user!
当按子窗体的最小化按钮时,能把子窗体隐藏起来;
 
没试验过,不过理论上可行,那就是移动子窗体
form1.left :=-10000
或类似做法
 
unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm_MDIChild = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
protected
procedure WndProc(var Message: TMessage); override;
public
{ Public declarations }
end;

var
Form_MDIChild: TForm_MDIChild;

implementation

{$R *.dfm}

procedure TForm_MDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//关闭时将窗口隐藏
WindowState := wsMinimized;
ShowWindow(Handle, SW_HIDE);

//Action = caFree; //关闭时释放
end;

procedure TForm_MDIChild.WndProc(var Message: TMessage);
begin
inherited;

//最小化时将窗口隐藏
if (Message.Msg = WM_SYSCOMMAND) and (Message.WParam = SC_MINIMIZE) then
ShowWindow(Handle, SW_HIDE);
end;

end.


重新显示子窗口:
ShowWindow(Form_MDIChild.Handle, SW_RESTORE);
 
学习 ,看来俺地方法太业余咯[:)]
 
接受答案了.
 
后退
顶部