@Katyusha_melnich

Не могу разобраться с списками List.Image, что нужно дописать в коде чтоб не был ошибки?

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"/>
  • Вопрос задан
  • 44 просмотра
Решения вопроса 1
HemulGM
@HemulGM
Delphi Developer, сис. админ
Не пиши ошибки, не будет ошибки
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы