FIX: Neg ScaleHeight Resizes Control When Form Saved as ASCII

Last reviewed: October 30, 1997
Article ID: Q95513
2.00 3.00 WINDOWS kbprg kbbuglist

The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0

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.

MORE INFORMATION

Steps to Reproduce Problem

  1. 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.

  2. 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)
    
    

  3. Add a command button (Command1) to Form1.

  4. 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

  5. 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.

  6. From the File menu, choose Open Project (ALT, F, O). In the Files box, select PROJECT1.MAK.

  7. 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.

  8. Using the mouse, click Form1 to change the focus to Form1.

  9. Press the Tab key to move the focus to the command button. Now Command1 becomes visible and the Properties window shows its properties.

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 reference words: buglist2.00 buglist3.00 fixlist4.00 2.00 3.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgOptTips
Keywords : PrgOptTips kbbuglist kbprg
Version : 2.00 3.00
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.