Hide MDI Form on MiniMize


I have tried this:


type
   TForm1 = class(TForm)
   public
     procedure WMSize(var M : TWMSIZE) ;
               Message WM_Size;
   end;

implementation

procedure TForm1.WMSize(var M:TWMSIZE) ;
begin
   if M.SizeType=Size_Minimized then
     showwindow(Handle,Sw_Hide) ;
end;

But .... When I resized the Form it does not Resize as expected.

Alo I have Panels Located on the "Left Side" and "Bottom" of my main MDI Form,
When I place Controls on these forms the BackGround Color is that of the Main MDI Form.
I want it to be Different. I want my Main MDI Backgroud Colour to be clGray and the rest of my application to be clBtnFace.

How do I resolved this.


cresttyAsked:
Who is Participating?
 
A. Cristian CsikiSenior System AdministratorCommented:
hy, try this:

public
   procedure WMSysCommand
     (var Msg: TWMSysCommand) ;
message WM_SYSCOMMAND;

procedure TForm1.WMSysCommand;
begin
   if (Msg.CmdType = SC_MINIMIZE) then
  ShowWindow(Application.Handle, SW_HIDE);
    DefaultHandler(Msg) ;
end;
0
 
cresttyAuthor Commented:
public
   procedure WMSysCommand
     (var Msg: TWMSysCommand) ;
message WM_SYSCOMMAND;

procedure TForm1.WMSysCommand;
begin

   DefaultHandler(Msg) ; //<<<<<<<<<<<<<<<<<<---Must be first.

   if (Msg.CmdType = SC_MINIMIZE) then
      ShowWindow(Application.Handle, SW_HIDE);
   end;


That Actually Works.


=======================================================
   My Panels that Changes to the BAckGround Colour of the Main MDI Form,
   how can I stop this from happening ?
=======================================================




0
 
Kyle FosterCEOCommented:
try turning off the property form.parentcolor and see if that fixes the color problem.
0
 
Kyle FosterCEOCommented:
sry not the forms property the controls property

control.parentcolor := false;
control.color := clblue;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.