Microsoft KB Archive/168554

= FIX: Resource Drain with PictureBox on Form =

Article ID: 168554

Article Last Modified on 11/21/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Control Creation Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q168554



SYMPTOMS
In Visual Basic 5.0 running under Windows 95 or Windows 98, setting the Appearance property of a PictureBox to 0-Flat causes resources to be lost each time the form is unloaded. If the Appearance Property is set to 1-3D, resources are not lost.

This occurs with a PictureBox placed either directly on a form or on a UserControl that is placed on the form.



RESOLUTION
Set the appearance property to 1-3D or use a different container, such as an Image control or UserControl, depending on your application.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in the Visual Studio 97 Service Pack 1.



Steps to Reproduce Behavior
 Place a PictureBox on a Form1 in a new project in Visual Basic 5.0. Set the Appearance property of the PictureBox to 0-Flat.  Add a Module to your project and add the following code to it: SUB Main DIM i as Integer

FOR i = 1 TO 1000 Form1.Show DoEvents Unload Form1 DoEvents Next i

END SUB

 Set the Startup Object of your project to Sub Main. Run the application while monitoring resources with a tool such as the Windows 95 Resource Meter. As the form is loaded and unloaded repeatedly, GDI resources will diminish.</li></ol>

Keywords: kbbug kbfix kbvs97sp1fix kbcontrol KB168554

-

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

© Microsoft Corporation. All rights reserved.