override minimise ?

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi friends.

How do I override minimise event ? so that it does not minimise and simply
hide my form ?

the reason is I have the problem with the form after its been minimised
calling activate or show does not bring it back again.

any help appreciated

thanks
Tom
 
Hi Tom,

you can override the WndProc event and check for the message that's being
sent.
Here's an example of how you can check for the minimize event:

const int WM_SYSCOMMAND = 0x0112;
const int SC_MINIMIZE = 0xF020;

protected override void WndProc(ref Message m)
{
switch ( m.Msg )
{
case ( WM_SYSCOMMAND ):
if ((int)m.WParam == SC_MINIMIZE)
System.Diagnostics.Trace.WriteLine("Minimizing the form now.");
break;
default:
break;
}

base.WndProc (ref m);
}

Cheers,
Branimir
 
Back
Top