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==]
Carl Daniel [VC++ MVP] - 23 Oct 2007 16:59 GMT
> 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
[quoted text clipped - 13 lines]
> 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
Peter Oliphant - 23 Oct 2007 21:35 GMT
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=]
>> 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
[quoted text clipped - 26 lines]
>
> -cd