Hello,
I'm using images to show a sequence. For this I'm using image list and the code is
Graphics g = this.panel2.CreateGraphics();
ImageList photoList = new ImageList();
photoList.TransparentColor = Color.Blue;
photoList.ColorDepth = ColorDepth.Depth32Bit;
photoList.ImageSize = new Size(40, 40);
Graphics g1 = this.panel2.CreateGraphics();
Pen green = new Pen(Color.Green, 1);
int j = 0, k = 0, count = 0, width = (panel2.Width - 80), lines = 0, count1 = 0; ;
lines = textBox8.Lines.Count();
foreach (string i in textBox8.Lines)
{
if ((i.Trim() != "") && (i.Trim() != "E"))
{
if (k < width)
{
string h = "Domain_" + i + ".png";
Stream imgStream3 = Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsFormsApplication2.Resources." + h + "");
photoList.Images.Add(new Bitmap(imgStream3));
if (count1 == 0)
{
photoList.Draw(g, new Point(k = k + 10, j), count);
}
else
{
photoList.Draw(g, new Point(k = k + 55, j), count);
}
count1 = count1 + 1;
count = count + 1;
if (lines != count)
{
g1.DrawLine(green, new Point(k + 40, j + 20), new Point(k + 80, j + 20));
}
// Paint the form and wait to load the image
Application.DoEvents();
}
}
}
but the problem is, if I change the tab or change the size of the form and come back then I can't see the images, they just disappeared. Is there something I did wrong.
Any help would be great.
thanks in advance