How to make the form hide when click MinimizeBox?
-
hi, one way is to check the form state in the form resize event and hide it if the state is minimized.
regards :)
-
hi, one way is to check the form state in the form resize event and hide it if the state is minimized.
regards :)
-
You need to catch the click on that button, which means you're probably going to catch the state change. So, restore it again, as well as hiding it.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You need to catch the click on that button, which means you're probably going to catch the state change. So, restore it again, as well as hiding it.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
hi, one way is to check the form state in the form resize event and hide it if the state is minimized.
regards :)
-
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! :)
All the best, Martin
-
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! :)
All the best, Martin
Sure, you could also minimize the form when the Close Box is hit, and close it when the Minimize Box is hit. Why not ? You do want a special app, dont you ? :-D
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
-
Sure, you could also minimize the form when the Close Box is hit, and close it when the Minimize Box is hit. Why not ? You do want a special app, dont you ? :-D
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
Luc Pattyn wrote:
Sure, you could also minimize the form when the Close Box is hit, and close it when the Minimize Box is hit. Why not ?
:laugh:
Luc Pattyn wrote:
You do want a special app, dont you ?
Off course, everybody can make it the "standard" way! :-D
All the best, Martin