procedure tform1.myminimize(var msg: TWMSYSCOMMAND); begin if msg.CmdType = sc_minimize then //最大 //化可以到windows单元中找 begin //.你要干的事 end else inherited; end;
type TForm1 = class(TForm) private { Private declarations } public { Public declarations } //消息映射机制 procedure myminimize(var msg: TWMSYSCOMMAND);message wm_syscommand; end;
var Form1: TForm1;
implementation
{$R *.dfm} procedure tform1.myminimize(var msg: TWMSYSCOMMAND); begin case msg.CmdType of sc_minimize: begin showmessage('最小化'); end ; SC_MAXIMIZE: begin showmessage('最大化'); end; else inherited; end;//end case end;