c#中在界面中有10个picturebox,怎样用判断语句判断他们中有无图片?

2026年09月22日 23:23
有1个网友回答
网友(1):

string value = "";
foreach (Control item in this.Controls)
{
if (item is PictureBox)
{
if (((PictureBox)item).Image==null)
{
value += ((PictureBox)item).Name + ',';

}
}
}
MessageBox.Show("控件" + value + "无图片");