BUG: eVB: Label with AutoSize = True Returns Incorrect Height at Run Time (265845)



The information in this article applies to:

  • Microsoft eMbedded Visual Basic 3.0
  • Microsoft Windows CE Toolkit for Visual Basic 6.0

This article was previously published under Q265845

SYMPTOMS

If you have a Label control that has its AutoSize property set to True, then the Height property returns the value set at design time or when it was last set.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open Microsoft eMbedded Visual Basic 3.0.
  2. Create a new Windows CE for the Pocket PC project. Form1 is created by default.
  3. Add a Label control and two Command Button controls to Form1.
  4. Paste the following code into Form1:
    Option Explicit
    
    Private Sub Command1_Click()
        Label1.AutoSize = True
    End Sub
    
    Private Sub Command2_Click()
        MsgBox "Height = " & Label1.Height & " Width = " & Label1.Width
    End Sub
    
    Private Sub Form_Load()
        Label1.Caption = "This is a two line " & vbLf & "caption for Label1."
        Label1.Font.Size = 14
        Label1.Height = 200
        Label1.Width = 200
    End Sub
    
    Private Sub Form_OKClick()
        App.End
    End Sub
    					
  5. Run the project in emulation or on the device.
  6. Click on Command2 to check the height and width dimensions for Label1. Both of them should be 200.
  7. Click on Command1 to set the AutoSize property to True. Note that both the height and width dimensions of the label have changed.
  8. When you click Command2, note that the height is still 200, although the width returns the new value.

Modification Type:MinorLast Reviewed:8/19/2005
Keywords:kbBug kbpending kbToolkit KB265845