Home All Groups Group Topic Archive Search About

XP vs Vista Component Height

Author
16 Nov 2007 9:32 PM
Lorin
VB6SP6
I have an app that I am moving to Vista.
Seems OK except for component heights.
On a resizable form I have from top to bottom
   Form's Caption Bar
   Form Menu
   Picturebox
   Frame
   Statusbar
All aligned and resize vertically OK on XP.
On Vista the Frame is a little low and is overlapping the Statusbar slightly.

Is there a rule of thumb, code-wise, to position controls that will work for
both XP and Vista?  Aero is on.
I am currently positioning the top of the frame with reference to the height
minus a constant.  Seems fine on XP, but not Vista.

Author
17 Nov 2007 2:22 AM
Steve Gerrard
Show quote
"Lorin" <Lo***@discussions.microsoft.com> wrote in message
news:B6192615-D4F5-4EE5-A804-4D94A89D9F7E@microsoft.com...
> VB6SP6
> I have an app that I am moving to Vista.
> Seems OK except for component heights.
> On a resizable form I have from top to bottom
>   Form's Caption Bar
>   Form Menu
>   Picturebox
>   Frame
>   Statusbar
> All aligned and resize vertically OK on XP.
> On Vista the Frame is a little low and is overlapping the Statusbar slightly.
>
> Is there a rule of thumb, code-wise, to position controls that will work for
> both XP and Vista?  Aero is on.
> I am currently positioning the top of the frame with reference to the height
> minus a constant.  Seems fine on XP, but not Vista.
>

I have not tried Vista, but I can tell you this about resizing and positioning.
Using a constant that seems right on your display will not work for everyone in
the general case. It is often about the width of borders, which can change quite
a bit with various display options, themes, DPI and Large Font settings, and so
on. I imagine Vista adds a few more. In some cases, the assumption that the X
and Y direction are the same is not correct.

The two main choices are to leave lots of space between things, or to find out
how big the borders are on the user's machine. This can be done with API calls,
such as GetSystemMetrics. It takes some fussing around to get the right values,
but once you do it, you have this problem solved for most cases.
Author
17 Nov 2007 11:30 AM
Mike Williams
"Lorin" <Lo***@discussions.microsoft.com> wrote in message
news:B6192615-D4F5-4EE5-A804-4D94A89D9F7E@microsoft.com...

> I have an app that I am moving to Vista.
> Seems OK except for component heights.

You're actually quite lucky that you've not had similar problems on other
machines (Win98, XP etc) as well. You always need to write your code so that
you position things in accordance with the current size of the client area
of the Form. Vista just gives you another reason for doing so.

> I am currently positioning the top of the frame with reference
> to the height minus a constant.  Seems fine on XP, but not Vista.

It won't work for XP either on many machines. Vista just makes it more
obvious that it doesn't work. You need to position stuff in accordance with
the ScaleHeight, not the Height.

Mike

AddThis Social Bookmark Button