Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95 
Author Message
 Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95

Hi everybody,
we use the PictureBox Control with VB5 to extensivly create dynamical images
and copy the images to a grid control. Multiple drawing/resizing the same
PictureBox results in 'out of GDI memory resources' error messages. What
alternative control we could use instead?

Any suggestions are welcome!

Torsten



Mon, 24 Jul 2000 03:00:00 GMT  
 Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95


Fri, 19 Jun 1992 00:00:00 GMT  
 Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95

Can't be sure it's the same problem that you're experiencing, but there is a
known problem of losing resources when accessing the "image" property of a
picturebox control under Win95. See Microsoft knowledge-base article Q174825
or this hyperlink:

http://support.microsoft.com/support/kb/articles/q174/8/25.asp

The article suggests a workaround (use the BITBLT API) which didn't really
meet my needs, but maybe it will work for you.

Good luck!

Quote:

>Hi everybody,
>we use the PictureBox Control with VB5 to extensivly create dynamical
images
>and copy the images to a grid control. Multiple drawing/resizing the same
>PictureBox results in 'out of GDI memory resources' error messages. What
>alternative control we could use instead?

>Any suggestions are welcome!

>Torsten



Mon, 24 Jul 2000 03:00:00 GMT  
 Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95

Have you installed any service packs?  SP2, especially, fixed a lot of
miscellaneous resource leaks.

Jim Deutch
MS Dev MVP



Quote:
> Hi everybody,
> we use the PictureBox Control with VB5 to extensivly create dynamical
images
> and copy the images to a grid control. Multiple drawing/resizing the same
> PictureBox results in 'out of GDI memory resources' error messages. What
> alternative control we could use instead?

> Any suggestions are welcome!

> Torsten



Mon, 24 Jul 2000 03:00:00 GMT  
 Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95

I believe this problem has been fixed in SP2: anyway, I just ran the
example and got no resource leak.

Jim Deutch
MS Dev MVP



Quote:
> Can't be sure it's the same problem that you're experiencing, but there
is a
> known problem of losing resources when accessing the "image" property of
a
> picturebox control under Win95. See Microsoft knowledge-base article
Q174825
> or this hyperlink:

> http://support.microsoft.com/support/kb/articles/q174/8/25.asp

> The article suggests a workaround (use the BITBLT API) which didn't
really
> meet my needs, but maybe it will work for you.

> Good luck!


> >Hi everybody,
> >we use the PictureBox Control with VB5 to extensivly create dynamical
> images
> >and copy the images to a grid control. Multiple drawing/resizing the
same
> >PictureBox results in 'out of GDI memory resources' error messages. What
> >alternative control we could use instead?

> >Any suggestions are welcome!

> >Torsten



Mon, 24 Jul 2000 03:00:00 GMT  
 Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95

I have VB5 SP3, and the bug is still here, but only with metafiles.
There is the same problem with Forms and Images.

Andrea Dazzi.



Tue, 25 Jul 2000 03:00:00 GMT  
 Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95

I've reproduced this, somewhat, with the following code.  I placed a
picturebox, set to AutoRedraw = True, an ImageList, and a button on a
form and put this code in the button click event:

Private Sub Command1_Click()
    Dim i As Long

    'loses about 4% GDI memory each click
    For i = 1 To 50
        Picture1.Cls   'leaks
        'Picture1.Picture = LoadPicture()   'leaks
        'Picture1.Line (0, 0)-Step(Picture1.ScaleWidth,
Picture1.ScaleHeight), Picture1.BackColor, BF  'no leak!
        Picture1.Line (Rnd * 100, Rnd * 100)-Step(Rnd * 700, Rnd * 700), 0&
        ImageList1.ListImages.Add , , Picture1.Image
    Next i
End Sub

Resizing the picturebox does not seem to affect the results.

The problem is in the .Cls: simply drawing a filled box in the
backcolor over the whole picturebox instead of clearing it cures the
resource leak.  I did this in Win95, VB5 SP2, HighColor (16-bit) video.

Jim Deutch
MS Dev MVP



Quote:
> Hi everybody,
> we use the PictureBox Control with VB5 to extensivly create dynamical
images
> and copy the images to a grid control. Multiple drawing/resizing the same
> PictureBox results in 'out of GDI memory resources' error messages. What
> alternative control we could use instead?

> Any suggestions are welcome!

> Torsten



Sat, 29 Jul 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. ListView eats GDI resources

2. Drawing image to picturebox using GDI

3. User & GDI Resources in Win95 / NT 4.0

4. resize and draw text in picturebox

5. resize and draw text in picturebox, need help!

6. User Resource & GDI Resource

7. PictureBox resizing with Form resize

8. Combo Boxes eating up system resources!

9. why vb5 eats resources - the answer!

10. vb5 eats resources?

11. Many Little Pictures Eating Up System Resources

12. minimize resources with image or pictureBox or resource???

 

 
Powered by phpBB® Forum Software