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)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询