BUG: PictureBox Must Be Sized Before the Image Is Displayed (286003)



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 Q286003

SYMPTOMS

When a picture is assigned to a PictureBox in a Handheld PC Pro project, the image does not display if the project is run in the emulator.

RESOLUTION

If the PictureBox control is sized prior to assigning the picture, the image appears as expected. To examine a workaround, uncomment the line of code in the "More Information" section of this article that increases the Width of the PictureBox.

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. Start a new Windows CE HPC Pro Project in Visual Basic. Form1 is created by default.
  2. In the Project Properties dialog box, make sure that the target to run on is set to emulation.
  3. In the Add File dialog box, add a bitmap to the project as a related document.
  4. In the Components dialog box, add a Microsoft CE PictureBox control to the project.
  5. Add a PictureBox to Form1.
  6. Add the following code in Form1's code module ("bitmap.bmp" should be changed to reflect the name of the related document file that was added to the project):
    Private Sub Form_Click()
        'PictureBox1.Width = PictureBox1.Width + 100
        PictureBox1.Picture = "bitmap.bmp"
    End Sub
    					
  7. Press the F5 key to run the program.
  8. Click on Form1, and note that the bitmap is not displayed in the PictureBox.
The problem also occurs if the DrawPicture method of the PictureBox control is used. The problem does not occur on the device or in other emulators. The problem does not occur if an Image control is used in place of the PictureBox.

Modification Type:MinorLast Reviewed:8/19/2005
Keywords:kbBug kbCtrl kbpending KB286003