private void ShowImageList()
{
this.Controls.Clear();
int i = 0;
foreach (Image tmp in imageList.Images)
{
PictureBox a = new PictureBox();
this.SuspendLayout();
a.Location =new Point (i*imageList.ImageSize .Width,0);
a.Image = tmp;
this.Controls.Add(a);
this.ResumeLayout(false);
i++;
}
}
按道理这段代码运行了就显示所有的图片,为什么我的就显示一个图片呢?
{
this.Controls.Clear();
int i = 0;
foreach (Image tmp in imageList.Images)
{
PictureBox a = new PictureBox();
this.SuspendLayout();
a.Location =new Point (i*imageList.ImageSize .Width,0);
a.Image = tmp;
this.Controls.Add(a);
this.ResumeLayout(false);
i++;
}
}
按道理这段代码运行了就显示所有的图片,为什么我的就显示一个图片呢?
你加一句a.BorderStyle = BorderStyle.Fixed3D;再看效果就知道是什么原因了