Problem Using List(Of Image)

  • Thread starter Thread starter dw80916
  • Start date Start date
D

dw80916

Guest
I am trying to use a List(Of Image) to store various images from a single picture box. The images displayed in the picture box are not from a file. They are data plotted and displayed in the picture box. The problem occurs when recalling these images.

All the images are the same as the last image added. One post that is most relevant advises to create a clone of the picture box's image and add that to the list. I've tried every variation I can think of but I'm having no success. Seems the List doesn't actually create a new bitmap when adding an image?

What I need to accomplish is:

1) Capture a picture box image and add to a List(Of Image). Up to about 25 images all the same size (921 x 531).

2) Recall an Image from List(Of Image).

I've got everything else working well, except for the glitch where all the recalled images are the same as last image added.

Greatly simplifying, it should work like this?

Public ImageList As New List(Of Image) ' Declare / Define the List

ImageList.Add(Bitmap) ' Add the bitmap to the list

Dim TraceRect As New Rectangle(50,190,750,460) ' Define the rectangle for printing

e.Graphics.DrawImage(ImageList.Item(PageNumber), TraceRect) ' Print the image in the list


Any pointers or assistance is greatly appreciated.

Continue reading...
 
Back
Top