Problem with VGA form.Height


Active Member
Licensed User
I'm modifying one of my applications to run on a VGA device. So far, things are going very well (thanks to everyone who suffered through the initial learning phase on VGA screens), but I've run into a problem.

My program places controls based on the height and width of the form, so it can adjust itself to landscape or portrait orientation on a variety of screen sizes.

When I place the controls at the bottom of the screen, I check the form.Height and place the controls accordingly. Problem is, the controls are mostly hidden behind the menu bar at the bottom. The top of a button placed (see below) at the bottom is just peeking out from behind the bar.

I'm doing something similar to:

   Button1.Top = Form1.Height - Button1.Height - 5
Yes, the SIP is hidden/collapsed.

I imagine I can find some magic number to adjust the 'top' values by, but that defeats the purpose of all the code I've written to make these forms adjust to the various screen resolutions and orientations.

Is there some magic way to get the height of the menu bar?



Note: This problem came up in this thread:, but without an answer or resolution.
Last edited:


Licensed User
I always leave a bottom margin of 52 pixels for VGA and 23 for QVGA. That seems to solve this problem. This also solves the problem of having horizontal scroll bars of tables hidden behind the menu bar.



Active Member
Licensed User
It does indeed solve the problem. Without any other method for determining the height of the bar, hardcoding the value seems the only way to go.

But I *really* hate hardcoded values. It reminds me of COBOL. (Oh, shucks, did I just use that word here?)