views:

1559

answers:

4

I want to prevent the user from maximizing the Windows Form to full screen so I have disabled the Maximize button. However, I want to be able to have the user 'restore' the Form. When they click the Restore button I want it to show a different, smaller, minified, form, which will show them a maximize button which will return the use to the original form.

Is there a way to do this?

Thanks.

edit: You don't understand, I'm not preventing the user from resizing the form. Whats happening is when the click the restore button, it will hide the form and open a new one with less controls on it. When they click maximize on the smaller form, it will return to the original form.

A: 

You can set the MaximumSize and MinimumSize and enable the maximize button to get this kind of effect.

Jon B
Actually, it moves it to the top right corner when I do that, although it does keep the right size
Malfist
A: 

I'm sorry, can you draw what you want?

Diones
Yes, if you come over to where I work I can show you what it should look like. I am a master drawer! I use boxes and circles and squares and all kinds of cool looking shapes. You'd be amazed!
Malfist
+1  A: 

FWIW, the right answer is to make your form resize properly, adapting to any window size and not to constrain the user to what looks right on your display at your resolution and your font size. Non-resizeable windows are one of the most annoying things I encounter in an application (Windows itself is full of them).

Software Monkey
You don't understand, I'm not preventing the user from resizing the form. Whats happening is when the click the restore button, it will hide the form and open a new one with less controls on it. When they click maximize on the smaller form, it will return to the original form.
Malfist
But doesn't that violate the principle of least surprise for the user? I expect restore to restore the window to the previous floating size I had, and maximize to fill my display.
Software Monkey
This is not a control that would ever be required to go fullscreen.
Malfist
On your display, perhaps. What about the phone or PDA user with a 320x240 or 800x600 display?
Software Monkey
+2  A: 

I looked at a similar problem to this at work and the only solutions I could find involved setting undocumented window styles, which I was not inclined to do.

Therefore the best solution to your problem I would think would be to hide the current minimize/maximize/restore buttons and add your own using some ownerdraw or other commands.

Looking at this from a user interaction perspective I would want the minimize/maximize/restore buttons to do exactly the same thing for your application as they do for all others. Overriding that functionality would create confusion for your users, hence why I would recommend creating different buttons either on the title bar or somewhere else on your interface that perform this function.

Daemin
I think I may have to do this.
Malfist