Microsoft KB Archive/95513

= FIX: Neg ScaleHeight Resizes Control When Form Saved as ASCII =

Article ID: 95513

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition

-



This article was previously published under Q95513



SYMPTOMS
If you set the ScaleHeight or ScaleWidth property of a container to a negative value, the Height or Width property of all child controls are saved incorrectly if the form is saved in ASCII format. When you re-load a form or its project that was previously saved in ASCII format, it may look like controls on the container have been removed. Actually, the child controls still exist, but their Height and Width properties were saved incorrectly, which results in significantly smaller controls.



WORKAROUND
To work around the problem:


 * 1) Resize the controls to their original size by using the mouse. You must use the mouse; you cannot resize the controls by changing the Height and Width properties in the Property window. Click the lower right-hand corner of the control and drag it down or to the right to make the control taller or wider, respectively.
 * 2) Save the form in binary format. From the File menu, choose Save Project (ALT, F, V) and clear the Save as Text check box option.



STATUS
Microsoft has confirmed this to be a bug in both the Standard and Professional Editions of Microsoft Visual Basic versions 2.0 and 3.0 for Windows. This problem has been corrected in Visual Basic version 4.0.



Steps to Reproduce Problem
 Run Visual Basic, or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.  From the Properties window, set the following properties of Form1:   ScaleMode:      0   (User) ScaleHeight: -100 ScaleWidth: -150 ScaleTop:   -100   Sets upper left hand corner coordinates ScaleLeft:  -150   of Form1 to (-150,-100)  Add a command button (Command1) to Form1.  From the Properties window, set the properties of the Command1 button as follows to place the command button in the middle of the form.   Top:  -150 Left: -200  From the File menu, choose Save Project (ALT, F, V). Select the Save as Text option and save the form using the default name of Form1. Save the project (Project1) using the default name.</li> From the File menu, choose Open Project (ALT, F, O). In the Files box, select PROJECT1.MAK.</li> From the Window menu, choose Project (ALT, W, R). Using the mouse, click View Form in the Project window. Form1 displays, and you can see that the Command1 button is significantly smaller, making it difficult to pinpoint where it is.</li> Using the mouse, click Form1 to change the focus to Form1.</li> Press the Tab key to move the focus to the command button. Now Command1 becomes visible and the Properties window shows its properties.</li></ol>

You can resize or move the command button by using the mouse. However, if you attempt to set the Height property of Command1 to a positive value, Visual Basic incorrectly changes the property to its minimum value. The minimum value for the Height property is based on the FontName and FontSize properties.

Additional query words: buglist2.00 buglist3.00 fixlist4.00 2.00 3.00

Keywords: kbbug kbfix KB95513

-

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

© Microsoft Corporation. All rights reserved.