C# 如何清空panel中pictureBox中的图片?(panel里面放了好多pictureBox)

2024-11-19 14:31:16
推荐回答(2个)
回答(1):

foreach (var item in this.panel1.Controls)
{
if (item is PictureBox)
{
((PictureBox)item).Image = null;
}
}
如果是全部都是PIctureBox : this.panel1.Controls.Clear();

回答(2):

picturebox.image=null;