Displaying an array of images in picturebox?

前端 未结 5 1056
北荒
北荒 2021-01-14 14:38

I\'m very new to visual C# I want to display an array of images in a picture box

Here\'s my code:

string[] list = Directory.GetFiles(@\"C:\\\\picture         


        
5条回答
  •  情话喂你
    2021-01-14 15:27

    //this code help you to work with picturebox in arraye

    public partial class Form_Begin : Form
        {
            PictureBox[] pictureBoxs = new PictureBox[50];
            public Form_Begin()
            {
                InitializeComponent();
                pictureBoxs[0] = pictureBox1;
                pictureBoxs[1] = pictureBox2;
                pictureBoxs[2] = pictureBox3;
                pictureBoxs[3] = pictureBox4;}
    
    
    
                List pictureBoxes = new List();
     private void buttonX1_Click(object sender, EventArgs e)
                {
                    for (int i = 0; i <2; i++)
                    {
                        pictureBoxs[i].Image =your_name_project.Properties.Resources.Image_1;                     // Load Image_1 from Resources on property of picturebox  
                    }
                    for (int i = 2; i < 4; i++)
                    {
                        pictureBoxs[i].Image =your_name_project.Properties.Resources.Image_2;                    // Load Image_12 from Resources on property of picturebox 
    
                    }
    

提交回复
热议问题