471,605 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Form.Height depending on Windows style?

Hi all,

I have an application with one particular form that lists a number of
items in a listview. In addition to the listview, there is a panel on
top with some simple controls to go back and forth to the next and
previous day.

Since the number of items in the list can vary from day to day - from
zero one day to thirty another, and five the third - my users like the
option to have the Window resize itself to exactly fit the number of
items. That way, no space is wasted on "short" days, and you don't have
to scroll up and down for the "longer" days.

I thought that when I use this.Height to get the form height, this would
represent the height of everything inside the window borders. So since
my listview has dock set to Fill, I thought I could basically subtract
the list height from the form height to get the "rest" height for
everything but the list, then add that to (listviewitem.height*items +
X) (where X is the size of the listview stuff apart from the items, that
I can figure out at compile time) to get the new form height.

And this works fine on my own computer, running Windows XP with the
"Windows Classic" style. However, it doesn't work at all on WinXP with
the "rounded" XP style. So, what gives? Is the internal form size
dependant on the window border size, or what?

Am I completely wrong in assuming that in a layout like this, with a
panel (top docked) and a listview, the form height would basically be

panel.Height + listview.Height == form.Height

- or is this wrong?

I know about SystemInformation.CaptionHeight and
SystemInformation.BorderSize.Height, but I would really think that my
form size should be independent of this?

Does anyone know a good "formula" for calculating this, that is
completely independent of the window decorations? I expect that there
are other "skins" and such for Windows that can alter these things
further and really makes it necessary to find a "neutral" way to
calculate this.

Any insight will be highly appreciated!


Feb 10 '06 #1
1 2204
Hi Rune,

If the problem is with the screen resolution of the user computers,
identify the screen resolution and have a display class to change your
controls location based on the user settings.


Feb 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Nomen Nescio | last post: by
2 posts views Thread by Roby Eisenbraun Martins | last post: by
11 posts views Thread by Jozef | last post: by
3 posts views Thread by Xwire | last post: by
3 posts views Thread by simora | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.