By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,507 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,507 IT Pros & Developers. It's quick & easy.

Form size differs in different OS's?

P: n/a
I'm developing a program at home on a Windows Vista computer. In it I create
a form with a few buttons on it that fill up the form's visible area.

So, I took the application to work, where I use a Windows XP PRO computer.
When I ran my program, the form visible area is different! Not very much,
but it is obvious. I haven't done experiments yet, but it looks like the
form is slightly wider and slightly shorter. I now have extra space on the
right of my buttons as well as the bottom clipping of the bottom button.

Why is this the case? And, more to the point, is there a way of detecting
what the actually VISIBLE size is to a form when establishing its size
(Width,Height) at RUNTIME? Or is this something to do with the coordinate
system being different (e.g., one OS considers the form boundary as part of
the size/space, the other does not, or differing amountsbased on some sort
of 'style'). I guess I could just add extra space to be sure, but this
behavior seems weird to me...

[==Peter==]
Oct 23 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Peter Oliphant wrote:
I'm developing a program at home on a Windows Vista computer. In it I
create a form with a few buttons on it that fill up the form's
visible area.
So, I took the application to work, where I use a Windows XP PRO
computer. When I ran my program, the form visible area is different!
Not very much, but it is obvious. I haven't done experiments yet, but
it looks like the form is slightly wider and slightly shorter. I now
have extra space on the right of my buttons as well as the bottom
clipping of the bottom button.
Why is this the case? And, more to the point, is there a way of
detecting what the actually VISIBLE size is to a form when
establishing its size (Width,Height) at RUNTIME? Or is this something
to do with the coordinate system being different (e.g., one OS
considers the form boundary as part of the size/space, the other does
not, or differing amountsbased on some sort of 'style'). I guess I
could just add extra space to be sure, but this behavior seems weird
to me...
This is, most likely, due to a difference in font rendering resolution
between the two systems (e.g. one at 96dpi and one at 100dpi). This is not
at all uncommon if one of the machines is a laptop and the other not.

Yes, you can make your program adapt by setting the right properties
(particularly AutoSize and the autosize mode property) on all of the
controls, containers and forms. I can't give you a recipe from memory - I'm
sure I'd miss something, because it does take a lot of fuss to make a forms
layout that looks "the same" on different resolutions, but it can be done.

-cd
Oct 23 '07 #2

P: n/a
Thanks Carl! It's not too big a deal, the difference is a few pixels, so if
I just make it big enough for every case I'll be good! :)

[==Peter=]

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:%2****************@TK2MSFTNGP02.phx.gbl...
Peter Oliphant wrote:
>I'm developing a program at home on a Windows Vista computer. In it I
create a form with a few buttons on it that fill up the form's
visible area.
So, I took the application to work, where I use a Windows XP PRO
computer. When I ran my program, the form visible area is different!
Not very much, but it is obvious. I haven't done experiments yet, but
it looks like the form is slightly wider and slightly shorter. I now
have extra space on the right of my buttons as well as the bottom
clipping of the bottom button.
Why is this the case? And, more to the point, is there a way of
detecting what the actually VISIBLE size is to a form when
establishing its size (Width,Height) at RUNTIME? Or is this something
to do with the coordinate system being different (e.g., one OS
considers the form boundary as part of the size/space, the other does
not, or differing amountsbased on some sort of 'style'). I guess I
could just add extra space to be sure, but this behavior seems weird
to me...

This is, most likely, due to a difference in font rendering resolution
between the two systems (e.g. one at 96dpi and one at 100dpi). This is
not at all uncommon if one of the machines is a laptop and the other not.

Yes, you can make your program adapt by setting the right properties
(particularly AutoSize and the autosize mode property) on all of the
controls, containers and forms. I can't give you a recipe from memory -
I'm sure I'd miss something, because it does take a lot of fuss to make a
forms layout that looks "the same" on different resolutions, but it can be
done.

-cd


Oct 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.