473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 1965
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris | last post by:
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. ...
8
by: Luke | last post by:
I have read the artivle on how to make forms, here it is: http://www.cs.tut.fi/~jkorpela/forms/choices.html For radio group buttons i would do : var buttonGroup = document.forms.elements; for...
6
by: Otie | last post by:
I have a project with a main form and a second form with a grid on it. Neither form is an MDI, thus neither form is a child - they are two independent forms. The CALCULATE button on the main form...
6
by: Herrcho | last post by:
in K&R Chapter 6.3 it mentions two methods to calculate NKEYS. and points out the first one which is to terminate the list of initializers with a null pointer, then loop along keytab until the...
4
by: ivan | last post by:
Hi, How can we calculate the stack and heap size requried by a C program. Is there any specific formula used? Please suggest. regards, Ivan
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
7
by: carterweb | last post by:
This is how I do it now. 1. Determine the dimensions of the rectangle. 2. Set a my font size to a fixed maximum size. 3. Apply the font my string and measure the string using the graphics...
4
by: vijay.db | last post by:
Hi Group, It's really confusing to calculate the size of the DB2 UDB database in versions lesser than 8.2. In Version 8.2 if we run the query db2 "call get_dbsize_info(?,?,?,0)" it gives us...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.