C#为列表中的每个项目创建图片框

时间:2016-06-09 11:45:33

标签: c#

到目前为止我已经

var championNamelist = new List<string>(championName);
var first5Names = championNamelist.Take(5);
var skip5Names = championNamelist.Skip(5);                  

foreach (string name in first5Names)
{
    string getPNG = "http://ddragon.leagueoflegends.com/cdn/6.11.1/img/champion/" + png + ".png";
}

championNamelist中是从XML中找到的所有名称。

如何获取表单上显示的所有图片?

1 个答案:

答案 0 :(得分:0)

如果想动态创建图片框,请尝试

PictureBox[] p = new PictureBox[10];
            for (int i = 0; i < 10; i++)
            {
                p[i] = new PictureBox();
                p[i].ImageLocation = "location";
                p[i].Location = new Point(0,0);
                p[i].Size = new Size(50, 50);
                this.Controls.Add(p[i]);
            }