Imagelist and picturebox

  • Thread starter Thread starter bic
  • Start date Start date
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.
 
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.
|
 
Back
Top