代码:
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
'插入图片1,双击。如果是空的就自动启动图象采集,如果是有图就提示是否重新采集。
Dim flag As Boolean
Try
PictureBox1.Load(Application.StartupPath & "\test1.jpg")
flag = False
Catch ex As Exception
flag = True
End Try
If flag Then
updatePIC.filename = Application.StartupPath & "\test1.jpg"
updatePIC.ShowDialog()
Try
PictureBox1.Load(Application.StartupPath & "\test1.jpg")
Catch ex As Exception
End Try
ElseIf MsgBox("图像已存在,是否需要重新采集?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
updatePIC.filename = Application.StartupPath & "\test1.jpg"
updatePIC.ShowDialog()
Try
PictureBox1.Load(Application.StartupPath & "\test1.jpg")
Catch ex As Exception
End Try
End If
End Sub
=========================
问题:上面的代码可以实现当已有图片后的操作,我希望同时实现第一次插入数据时候的空白图片。谢谢