Form positioning when maximized

T

timtos

Hello.
I´ve got a form which maximum size is 300x300 pixels.
It can be resized and maximized. The problem:

If the user sets the window state to maximized, the forms location
is set to 0,0. Changing the Location property doesn´t help.

Is it possible to center it on the screen even if maximized?
And if yes, how is it done?

Thanks for any ideas,
timtos.
 
T

timtos

But if the user makes the form smaller it would be nice if he
can push the maximize button to get it back to 300x300 pixels
- and have it again centered on the screen.

Of course I can create my own button which does the job
but I think it is more intuitive to use the windows-style...

But anyway - thanks for answering!
Greetings, timtos.
 
G

Goran Genter

timtos said:
But if the user makes the form smaller it would be nice if he
can push the maximize button to get it back to 300x300 pixels
- and have it again centered on the screen.

Then why is window sizeable when you are limiting its Max size.
Set fixed window, and you have no problems.
 
M

Michael Mayer

timtos said:
But if the user makes the form smaller it would be nice if he
can push the maximize button to get it back to 300x300 pixels
- and have it again centered on the screen.

Of course I can create my own button which does the job
but I think it is more intuitive to use the windows-style...

I don't know if that's more intuitive or not. Generally, that button means
"maximize this window so it fills the screen" and I can't think of the last
time I saw that button do anything other than that. And how do you know the
user wants the location to be the middle of the screen? They might want it
at full size (300x300), but in the lower right corner of the screen.

I guess I'm not a big fan of "maximum size" to begin with - can't think of
any problems it solves (in contrast to minimum size which is very nice to
keep controls from overlapping each other). I'd either go with a fixed size
form, or else let the user size it however they want, and let them put it
where they want. That's most consistent with windows behavior.

I suppose you can watch the Resize event, check for WindowState = Maximized,
and then programmaticly unmaximize and set the location, but I think that
will end up causing about 10 other problems, especially when they try to
"unmaximize".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top