如何判断一个picturebox是否有载入图片vb.net
2个回答
展开全部
Try
If PictureBox1.Image.ToString <> "" Then
Label1.Text = "有图像"
End If
Catch ex As Exception
Label1.Text = "无图像"
End Try
VB.Net 用代码为picturebox 打开一张图片:
Dim fn As String = "D:\test.jpg"
'方法1
Me.PictureBox1.ImageLocation = fn
'方法2
Me.PictureBox1.Image = Image.FromFile(fn)
If PictureBox1.Image.ToString <> "" Then
Label1.Text = "有图像"
End If
Catch ex As Exception
Label1.Text = "无图像"
End Try
VB.Net 用代码为picturebox 打开一张图片:
Dim fn As String = "D:\test.jpg"
'方法1
Me.PictureBox1.ImageLocation = fn
'方法2
Me.PictureBox1.Image = Image.FromFile(fn)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以使用picturebox1.image.tostring是否为空来判断
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询