这是一个例子,可以打开扫描仪,但是不能拍照,原因是在以下黄色部分代码执行时出现了错误,是什么原因?
Dim pic As WinForm.PictureBox = e.Form.Controls("PicView")
Dim pic2 As WinForm.PictureBox = e.Form.Controls("PicView2")
Dim cam As WinForm.Control = e.Form.Controls("CamView")
Dim box As WinForm.Control = e.Form.Controls("LineBox")
msgbox(1)
'预览框尺寸
Dim x As Integer = cam.Left
Dim y As Integer = cam.Top
Dim w As Integer = cam.Width
Dim h As Integer = cam.Height
'截图框尺寸
Dim x1 As Integer = box.Left
Dim y1 As Integer = box.Top
Dim w1 As Integer = box.Width
Dim h1 As Integer = box.Height
msgbox(2)
'摄像头拍照
_Cap.GrapImg()
msgbox(5)
pic.Image = _Cap.GetBitmap()
msgbox(4)
'摄像头分辨率
msgbox(pic.Image.Width)
Dim camw As Integer = pic.Image.Width
Dim camh As Integer = pic.Image.Height