开发者

Delphi - form maximized event

I want to call a function after a form has been maxmized or restored. I know I can something like this:

procedure TfrmMain.WMSysCommand;
begin
   if (Msg.CmdType = SC_MAXIMIZE) OR (Msg.CmdType = SC_RESTORE) then
   begin
     Showmessage(IntToStr(frmMain.Height));
   end;
   DefaultHandler(Msg) ;
end;

But the problem is: this event is fired before the form is actually resized - so when the form is maximized, I get the height of the form BEFORE it was maxmized (but I want the width of the form afte开发者_StackOverflowr it has been maximized).

How to do this? Thanks!


the following link maybe will help you:

http://www.tek-tips.com/viewthread.cfm?qid=809465&page=176

declare this into interface section of this unit

Procedure sizeMove (var msg: TWMSize); message WM_SIZE; 

and implementation of this procedure:

Procedure TfrmMain.sizeMove (var msg: TWMSize);
begin 
 inherited; 
 if (msg.SizeType = SIZE_MAXIMIZED) OR (msg.SizeType = SIZE_RESTORED)then   
  resizeQlikViewReports(); 
end;


You can use OnResize either and check WindowState. It's easier way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜