Microsoft KB Archive/79242

= BUG: Some Property Values May Be Incorrect in Maximized Form =

Article ID: 79242

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 1.0 Standard Edition
 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Windows 3.0 Standard Edition
 * Microsoft Windows 3.1 Standard Edition

-



This article was previously published under Q79242



SYMPTOMS
The Top, Left, ScaleHeight, and ScaleWidth properties of a maximized Visual Basic for Windows 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.



CAUSE
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 Microsoft Windows versions 3.0 and 3.1, not with Visual Basic.



STATUS
Microsoft has confirmed this to be a bug in Microsoft Windows versions 3.0 and 3.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



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 axis for an object's internal coordinate system, and ScaleWidth sets or returns the horizontal axis. On a form, the coordinate system includes the form's internal area, not including borders and title bar.

Steps to Reproduce Problem
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 the form. 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.

Here's another example. This occurs when you use the following code in a maximized form with a ScaleMode of 1 (twips) in a 800-by-600 (pixel) screen resolution: Sub Form_Click Print &quot;Screen = &quot;; screen.width; &quot;, &quot;; screen.height ' Enter each Print statements on one, single line. Print &quot;Form = &quot;; form1.width; &quot;, &quot;; form1.height; &quot; at &quot;; form1.left; &quot;, &quot;; form1.top Print &quot;--- &quot; End Sub The following is the results:   Screen = 12000, 9000 Form = 12120, 9120 at -60, -60

Additional query words: buglist3.00 buglist3.10 2.00 3.00 3.10

Keywords: kbbug KB79242

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.