程序中用到一个picturebox,用户可加载图片,不知怎么判断图片是否存在?
谢谢各位朋友的回答,我再解释一下,我的意思是怎样判断Picturebox中当前是否已经加载图片了,而不是说判断所要加载的文件的有效性。
Try
If PictureBox1.Image.ToString <> "" Then
Label1.Text = "有图像"
End If
Catch ex As Exception
Label1.Text = "无图像"
End Try
If PictureBox1.Image.ToString <> "" Then
Label1.Text = "有图像"
End If
Catch ex As Exception
Label1.Text = "无图像"
End Try
温馨提示:答案为网友推荐,仅供参考
第1个回答 2008-03-14
如果有图片PICTURE的值不等于0.
第2个回答 2008-03-14
If Picture1.Picture = LoadPicture Then MsgBox "没载入图片"