ID Number: Q79242
1.00
WINDOWS
Summary:
The Top, Left, ScaleHeight, and ScaleWidth properties of a maximized
Visual Basic form may return incorrect values. When a form is
maximized, the values returned by these properties should be close to
the resolution of your monitor. The only difference between the
property values returned and the resolution should be due to
BorderStyles, menus, or title bars, and should in no case be greater
than the resolution of your monitor.
In some cases, with a maximized form, the returned property values can
be greater than the screen resolution. This is because of a problem in
the Windows API routine, GetClientRect(), which Visual Basic calls to
get the form properties. This is a problem with Windows 3.0, not with
Visual Basic.
This information applies to the Microsoft Visual Basic programming
system version 1.0 for Windows.
More Information:
The Left property determines the distance between the internal left
edge of an object and the left edge of its container.
The Top property determines the distance between the internal top edge
of an object and the top edge of its container.
ScaleHeight sets or returns the range of the vertical axes for an
object's internal coordinate system, and ScaleWidth sets or returns
the horizontal axes. On a form, the coordinate system includes the
form's internal area, not including borders and title bar.
Example
-------
To duplicate the problem, experiment with various BorderStyles,
set ScaleMode to pixels, and add the following code:
Sub Form_Click()
Print Left,Top ,ScaleWidth,ScaleHeight
End Sub
Run the application and click on the form, and note the values
printed. With no border, the values should correspond to the
resolution of your monitor, and should change slightly for each
BorderStyle from the addition of borders, menus, and title bars.
One example of the problem occurs using the following code in a
maximized form using a ScaleMode of 1 (twips) with 800-by-600 (pixel)
screen resolution:
Sub Form_Click
Print "Screen = "; screen.width; ", "; screen.height
Print "Form = "; form1.width; ", "; form1.height;
" at "; form1.left; ", "; form1.top
Print "-------------------------------------------------------
------------------------"
' Note that each Print statement above must be on just one line.
End Sub
The results under the above conditions are:
Screen = 12000, 9000
Form = 12120, 9120 at -60, -60
Additional reference words: 1.00 buglist3.00