我在运行时在同一个foreach循环中创建了Pictureboxes和标签,并且所有这些图片框和标签都位于flowlayoutpanel上。
我是如何创建这些控件的
foreach (var item in nodes)
{
imgurl = GetPictureFromData(item);//this string takes pic of film from a website with a function
filmname = GetFilmName(item);//this string takes film name from same website with a function
rating = GetFilmRate (item);//this takes imdb rating with a function
Label lb = new Label {AutoSize = true, Margin = new Padding(190,0,0,0) };
PictureBox pb = new PictureBox();//Movie pics
lb.Font = new Font(Label.DefaultFont, FontStyle.Bold);
lb.Text = filmname+" "+ rating+"/10" ;
pb.ImageLocation = imgurl;
pb.SizeMode = PictureBoxSizeMode.AutoSize ;
flowLayoutPanel1.Controls.Add(pb);
flowLayoutPanel1.Controls.Add(lb);
lb.BringToFront();
pb.BringToFront();
}
从同一网页上拍摄的所有照片和标签。我想要做的是将所有标签向下移动到相关图片旁边。