public Form5()
{
List<Image> list = new List<Image>();
foreach (string imageFile in images)
{
list.Add(Image.FromFile(imageFile));
}
imageList.Images.AddRange(list.ToArray());
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
this.Size = new Size(1530, 850);
this.MaximumSize = new System.Drawing.Size(1530, 850);
this.MinimumSize = new System.Drawing.Size(1530, 850);
DirectoryInfo dirImages = new DirectoryInfo("C:\\Users\\OWNER\\source\\repos\\Antonov\\Antonov\\2021");
iPicList.ImageSize = new Size(256,256);
iPicList.TransparentColor = Color.White;
myGraphics = Graphics.FromHwnd(panel1.Handle);
foreach (FileInfo file in dirImages.GetFiles())
{
if (file.Extension == ".jpg")
{
Image myImage = Image.FromFile(file.FullName);
iPicList.Images.Add(myImage);
}
}
if (iPicList.Images.Empty != true)
{
panel1.Refresh();
currentImage = 0;
// Draw the image in the panel.
iPicList.Draw(myGraphics, 1, 1, currentImage);
// Show the image in the PictureBox.
pictureBox1.Image = iPicList.Images[currentImage];
label1.Text = "Image #" + currentImage;
}
}
<img src="https://habrastorage.org/webt/60/95/13/609513393d870914606581.png" alt="image"/>