I was just wondering how to make a 'Restore' button in my Form? But changes from Maximized to Restore on the button?
In the standard Windows user interface, the maximize and restore button are one-in-the-same. They are both controlled by the center button in a group of three buttons
In a normal, non-maximized window, the center button is a "box" shape, and clicking on it causes the window to be maximized:
In a maximized window, the center button changes to display stacked tiles, and clicking on it restores the window to a non-maximized state:
In other words, the center "Maximize" button is a toggle. The only option with a maximized window is to restore it, and the only option with a normal window is to maximize it. You can never maximize a maximized window, and you can never restore a normal, non-maximized window. As such, having individual buttons for this would be a waste of real estate. They'd just sit there perpetually grayed out.
So setting the form's MaximizeBox
property to True is what you want to do. You can do this either in the Properties Window in the designer, or using code in the form class's New
method:
Me.MaximizeBox = True
If you really wanted to have a fourth button, you'd have to take over drawing the window's title bar yourself. Which is a really big job, probably not one that you're up for, since you indicate in a comment that you're new to VB.NET. And most of the work will have little to do with VB.NET and more to do with Win32 programming. Unless you're already an expert Win32 programmer migrating over to VB.NET as a new language, you will want to settle for the default behavior. And things got even worse for developers trying to customize the title bar starting with Windows Vista—the Aero Glass effect does not lend itself well to being customized. I don't know how things behave with Windows 8, but I doubt it's gotten any easier. If you're really interested in this, you can find plenty of information online, even in questions here on Stack Overflow (for example, here, here, and here).
And honestly, even if you were an expert Win32 programmer, I'd say you should settle for the default behavior anyway. Even if you don't think it's ideal, it is what your users are accustomed to. All of the other applications on their system behave this way.