Microsoft KB Archive/286003

= BUG: PictureBox Must Be Sized Before the Image Is Displayed =

Article ID: 286003

Article Last Modified on 8/19/2005

-

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 &quot;More Information&quot; 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.



Steps to Reproduce Behavior
 Start a new Windows CE HPC Pro Project in Visual Basic. Form1 is created by default. In the Project Properties dialog box, make sure that the target to run on is set to emulation. In the Add File dialog box, add a bitmap to the project as a related document. In the Components dialog box, add a Microsoft CE PictureBox control to the project. Add a PictureBox to Form1.  Add the following code in Form1's code module (&quot;bitmap.bmp&quot; 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 = &quot;bitmap.bmp&quot; End Sub </li> Press the F5 key to run the program.</li> Click on Form1, and note that the bitmap is not displayed in the PictureBox.</li></ol>

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.

Keywords: kbbug kbctrl kbpending KB286003

-

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

© Microsoft Corporation. All rights reserved.