Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to make the form hide when click MinimizeBox?

How to make the form hide when click MinimizeBox?

Scheduled Pinned Locked Moved C#
tutorialquestion
11 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jason_mf
    wrote on last edited by
    #1

    look subject.

    P 1 Reply Last reply
    0
    • J jason_mf

      look subject.

      P Offline
      P Offline
      PandemoniumPasha
      wrote on last edited by
      #2

      hi, one way is to check the form state in the form resize event and hide it if the state is minimized.

      regards :)

      J 2 Replies Last reply
      0
      • P PandemoniumPasha

        hi, one way is to check the form state in the form resize event and hide it if the state is minimized.

        regards :)

        J Offline
        J Offline
        jason_mf
        wrote on last edited by
        #3

        but it seem Minimize also. Has a simple Method that the form hide only

        C S M 3 Replies Last reply
        0
        • J jason_mf

          but it seem Minimize also. Has a simple Method that the form hide only

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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 )

          J 1 Reply Last reply
          0
          • J jason_mf

            but it seem Minimize also. Has a simple Method that the form hide only

            S Offline
            S Offline
            sam
            wrote on last edited by
            #5

            set this.ShowInTaskbar = false; hope it will help

            J 1 Reply Last reply
            0
            • C Christian Graus

              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 )

              J Offline
              J Offline
              jason_mf
              wrote on last edited by
              #6

              Thanks.

              1 Reply Last reply
              0
              • S sam

                set this.ShowInTaskbar = false; hope it will help

                J Offline
                J Offline
                jason_mf
                wrote on last edited by
                #7

                Thanks

                1 Reply Last reply
                0
                • P PandemoniumPasha

                  hi, one way is to check the form state in the form resize event and hide it if the state is minimized.

                  regards :)

                  J Offline
                  J Offline
                  jason_mf
                  wrote on last edited by
                  #8

                  Thanks

                  1 Reply Last reply
                  0
                  • J jason_mf

                    but it seem Minimize also. Has a simple Method that the form hide only

                    M Offline
                    M Offline
                    Martin 0
                    wrote on last edited by
                    #9

                    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

                    L 1 Reply Last reply
                    0
                    • M Martin 0

                      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

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #10

                      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] }


                      M 1 Reply Last reply
                      0
                      • L Luc Pattyn

                        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] }


                        M Offline
                        M Offline
                        Martin 0
                        wrote on last edited by
                        #11

                        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

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups