Button positions and sizes

R

Ray Mitchell

Hello,

I have developed several GUI applications that need to run platforms with
varying resolutions and font settings. I originally thought, obviously
mistakenly, that for any given GUI window developed by merely dragging
different controls from the Visual Studio toolbox onto the GUI window,
everything would merely scale properly when moved to a different platform.
What I am finding, however, is that in many cases this only happens in a very
minimal and unsatisfactory way. While looking perfect on the development
platform, on a different platform sometimes the buttons are so big they
overlap other controls. In other cases some of the other controls completely
cover the buttons. In some cases the text boxes are no longer wide enough to
display the complete text. Often the GUI is virtually unusable because of
this behavior. Sometimes even on different platforms with the same
resolutions and fonts the GUI looks totally different. The worst looking
display is when I run my GUI on WinXP when running in a Linux VMware virtual
machine - even though the resolution and fonts are the same as on the
development platform. However, most commercial applications don't seem to
care what platform the run on; they look the same.

I believe I could possibly solve this by run-time calculating the desired
relative positions and sizes of all the controls and positioning them that
way, but that seems like a pretty radical approach. I suppose I could also
custom tailor a version for each platform I know that will be used but I
can't believe this is how it should be done. I'm using buttons, text boxes,
group boxes, split containers, an a lot of other controls. Any suggestions
are welcome.

Thanks,
Ray
 
P

Peter Duniho

eOn Fri, 17 Jul 2009 17:48:01 -0700, Ray Mitchell
Hello,

I have developed several GUI applications that need to run platforms with
varying resolutions and font settings. I originally thought, obviously
mistakenly, that for any given GUI window developed by merely dragging
different controls from the Visual Studio toolbox onto the GUI window,
everything would merely scale properly when moved to a different
platform.
What I am finding, however, is that in many cases this only happens in a
very
minimal and unsatisfactory way. [...]

Yup. Not to excuse Microsoft, but it's actually a non-trivial problem,
due to the variety of fonts that may or may not be present, what the
default fonts are, and the fact that fonts don't necessarily scale
linearly.

On two identical computers -- same OS, settings, etc. -- there should be
no difference. But otherwise, it's hard to get things to work exactly
right.

That said, you should double-check to make sure the auto-sizing properties
on the Forms controls are set as you want. .NET _should_ be doing at
least a good enough job that as long as you don't make the GUI too
"tight", things don't wind up messed up.

I suggest designing with your own system set to "Large Fonts", leave
yourself a little bit of margin inside controls and between them, and make
sure your Forms controls are in fact set to auto-size according to the
font, etc. (in the Designer properties for each control...though, I think
the default is in fact to do that).

Just wait until you have to localize your projects and you find that your
carefully laid-out controls have to be completely redone to account for
the fact that your target language requires a lot more letters for each
word than English does. :)

Pete
 

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