"Minimize to tray" button in title bar
-
The .NET Framework base class libraries do not contain functionality for working with the non-client areas of a window frame (other than setting the caption, setting the border style, and showing or hiding the control, minimize, maximize, adn restore buttons). In order to do this, you have to go back to Win32 practices of handling notification messages, so Win32 programming experience will help. You can find an old discussion of the process here: http://www.dotnet247.com/247reference/msgs/35/178321.aspx[^].
Microsoft MVP, Visual C# My Articles
-
There are two alternatives to Heath's reply, but his suggestion is the best. Alternative 1: Show absolutely none of the border area (there are properties in Windows Forms that you can use to hide them). Then, draw all the content you want on your own, putting normal buttons wherever you want them. The problem is that you must handle "hit testing" in order to let the user drag or resize the window, since Windows no longer does that work for you. There are several places to find information about that. Look to handle the WM_NCHITTEST message. Alternative 2: Create a separate form that floats over your main window. It would contain only the button(s) that you desire, with no border or spacing. Once that window is created, you can manually position it to sit wherever you like. The problem is that the window is free-floating, so you need to reposition it every time your main form is moved or resized. This is the ugliest solution, since the users can see this button lagging while the rest of the window moves nicely. John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.