Click here to Skip to main content
15,915,336 members
Home / Discussions / C#
   

C#

 
QuestionHow to make the form hide when click MinimizeBox? Pin
jason_mf24-Jul-07 19:36
jason_mf24-Jul-07 19:36 
AnswerRe: How to make the form hide when click MinimizeBox? Pin
PandemoniumPasha24-Jul-07 20:08
PandemoniumPasha24-Jul-07 20:08 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
jason_mf24-Jul-07 20:26
jason_mf24-Jul-07 20:26 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
Christian Graus24-Jul-07 20:45
protectorChristian Graus24-Jul-07 20:45 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
jason_mf24-Jul-07 20:58
jason_mf24-Jul-07 20:58 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
sam#24-Jul-07 20:56
sam#24-Jul-07 20:56 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
jason_mf24-Jul-07 20:58
jason_mf24-Jul-07 20:58 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
Martin#24-Jul-07 21:00
Martin#24-Jul-07 21:00 
Hello,

You could override the WndProc method like this.
But be aware that you will not see the Form in taskbar and the user has no chance to make the form visible again unless you provide some functionality.
const int WM_SYSCOMMAND = 0x112;
const int SC_MINIMIZE = 0xF020;

protected override void WndProc( ref Message m )
{
    if( m.Msg == WM_SYSCOMMAND )
    {
        if( m.WParam.ToInt32() == SC_MINIMIZE )
        {
            this.Hide();
            return;
        }
    }
    base.WndProc( ref m );
}

Hope it helps!

P.S.: Luc, I know that it is bad, too influent the behaviour of standard form, but I can't resist ansering the questions! Smile | :)

All the best,

Martin

GeneralRe: How to make the form hide when click MinimizeBox? Pin
Luc Pattyn24-Jul-07 22:24
sitebuilderLuc Pattyn24-Jul-07 22:24 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
Martin#24-Jul-07 22:36
Martin#24-Jul-07 22:36 
GeneralRe: How to make the form hide when click MinimizeBox? Pin
jason_mf24-Jul-07 20:59
jason_mf24-Jul-07 20:59 
Questionhow to pass parameter in crystal report? Pin
help as an alias24-Jul-07 19:28
help as an alias24-Jul-07 19:28 
AnswerRe: how to pass parameter in crystal report? Pin
phantanagu24-Jul-07 21:43
phantanagu24-Jul-07 21:43 
GeneralRe: how to pass parameter in crystal report? Pin
help as an alias24-Jul-07 21:56
help as an alias24-Jul-07 21:56 
GeneralRe: how to pass parameter in crystal report? Pin
Developer61125-Jul-07 2:22
Developer61125-Jul-07 2:22 
QuestionDeactivating a form... Pin
Shy Agam24-Jul-07 18:46
Shy Agam24-Jul-07 18:46 
AnswerRe: Deactivating a form... Pin
Paul Conrad24-Jul-07 19:06
professionalPaul Conrad24-Jul-07 19:06 
GeneralRe: Deactivating a form... Pin
Shy Agam25-Jul-07 1:09
Shy Agam25-Jul-07 1:09 
AnswerRe: Deactivating a form... Pin
il_masacratore24-Jul-07 21:38
il_masacratore24-Jul-07 21:38 
GeneralRe: Deactivating a form... Pin
Shy Agam25-Jul-07 1:08
Shy Agam25-Jul-07 1:08 
GeneralRe: Deactivating a form... Pin
il_masacratore25-Jul-07 2:45
il_masacratore25-Jul-07 2:45 
AnswerRe: Deactivating a form... Pin
Shy Agam25-Jul-07 2:11
Shy Agam25-Jul-07 2:11 
GeneralRe: Deactivating a form... Pin
Paul Conrad25-Jul-07 6:12
professionalPaul Conrad25-Jul-07 6:12 
QuestionAbout TreeView Questions! Pin
snowlover24-Jul-07 15:48
snowlover24-Jul-07 15:48 
Questionis there any way to check the DataTable has been populated? Pin
Khoramdin24-Jul-07 13:00
Khoramdin24-Jul-07 13:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.