The information in this article applies to:
SYMPTOMSAs more text is added to a Label Control that has the AutoSize and WordWrap properties set to True, both the width and the height of the label increase. This is not what you might expect, which is that only the height of the label would increase. WORKAROUNDSet the Width property back to the original width explicitly after adding text to the caption of the label. STATUSMicrosoft is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available. This behavior has been modified in Visual Basic version 4.0. Increases in the width of the Label control after text is added to the caption are now significantly smaller than the increases seen in version 3.0, although they do still occur. Also, in version 4.0, the width of the label doesn't become larger and larger when you repeatedly add text to the caption. In Version 3.0, the width of the label continues increasing as more text is repeatedly added to the caption. MORE INFORMATIONSteps to Reproduce Behavior
Example WorkaroundTo prevent the width from becoming excessively large, you can use this code:
This workaround suitable only for solving the large increases in label
width that are seen in version 3.0. The AutoSize feature will probably
cause the final width of the control to be slightly larger than the
original width of the label as more text is added, even when the width is
explicitly set. The differences between the initial and final widths of the
control after text is added to the caption will depend on the content of
the new caption and the font characteristics.
By setting the AutoSize property of the label to False before setting the label width back, the original width can be obtained. However, this will result in text being truncated. Additional query words: kbVBp400 kbVBp300 kbCtrl kbDSupport kbdsd
Keywords : kbGrpVB |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |