Imagelist and picturebox

B

bic

I am trying to change my image in a picturebox by using images from an
imagelist.

I have tried

Dim Image1 As Image = ImageList1.Images(intIcon)
Me.pbLocation.Image = Image1
Image1.Dispose()

Without any luck, the code doesn't give an error and it doesn't update
the image in the picturebox, and the picturebox has repaint problem
after I load a new form and top of it and close it.
 
J

Joe Bork [MSFT]

Hello,

Why are you Disposing the image while it is still being displayed in the
PictureBox? You shouldn't dispose the Image object until you are no longer
using it. I've written a short app which uses and ImageList with multiple
images and displays them using a PictureBox, and I don't see any repainting
issues when not Disposing the images.

--Joe


--------------------
| From: (e-mail address removed) (bic)
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Imagelist and picturebox
| Date: 22 Oct 2003 04:57:57 -0700
|
| I am trying to change my image in a picturebox by using images from an
| imagelist.
|
| I have tried
|
| Dim Image1 As Image = ImageList1.Images(intIcon)
| Me.pbLocation.Image = Image1
| Image1.Dispose()
|
| Without any luck, the code doesn't give an error and it doesn't update
| the image in the picturebox, and the picturebox has repaint problem
| after I load a new form and top of it and close it.
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top