471,338 Members | 1,009 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Forms inaccuratly calculate size

I have a fairly straight-forward form that loads preferences upon
running, and saves them upon exiting. Included in the preferences are
things like window size & location, working directory, etc. There
seems to be a problem with the way the size of the form is being
calculated. If you run/exit/run/exit a bunch of times, the form keeps
growing vertically. This is because it looks like the forms Menu is
not being included into the size calculation. For example, if you set
the size programatically to 640x480, when the form displays, it adds in
19 vertical pixels for the menu to make the size 640x499. Then the
prefs write out, then on next load, the size is 640x518...and so on.

Subtracting the height of the menu when writing out the preferences
seems like the obvious answer, but it seems kludge-y, as the user might
have large fonts or something that will make a hard-coded subtract 19 a
bad idea. As far as I can tell, there isn't an easy way to tell the
height of a Menu object.

Has anyone run into this, or have a good solution for dynamically
calculating the height of a menu?

Thanks,
Chris

Jul 21 '05 #1
4 1788
mdb
"Chris" <cm******@gmail.com> wrote in news:1117568313.596901.48250
@g14g2000cwa.googlegroups.com:
Has anyone run into this, or have a good solution for dynamically
calculating the height of a menu?


Not sure, but you might try writing/saving Form.ClientSize instead of
Form.Size. I would think that ClientSize wouldn't include the size of any
menus.

--
-mdb
Jul 21 '05 #2
mdb
"Chris" <cm******@gmail.com> wrote in news:1117568313.596901.48250
@g14g2000cwa.googlegroups.com:
Has anyone run into this, or have a good solution for dynamically
calculating the height of a menu?


Not sure, but you might try writing/saving Form.ClientSize instead of
Form.Size. I would think that ClientSize wouldn't include the size of any
menus.

--
-mdb
Jul 21 '05 #3
I tried clientsize too. Actually, I tried all of the obvious ones,
Size, ClientSize, DesktopBounds and all of them do the same thing, and
only vertically. Removing the menu from the window altogether stops
this from happening.

Jul 21 '05 #4
I tried clientsize too. Actually, I tried all of the obvious ones,
Size, ClientSize, DesktopBounds and all of them do the same thing, and
only vertically. Removing the menu from the window altogether stops
this from happening.

Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Chris | last post: by
8 posts views Thread by Luke | last post: by
4 posts views Thread by ivan | last post: by
3 posts views Thread by Joshua Russell | last post: by
21 posts views Thread by Dan Tallent | last post: by
reply views Thread by rosydwin | 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.