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")
\'预览框尺寸
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
\'摄像头拍照
_Cap.GrapImg()
pic.Image = _Cap.GetBitmap()
\'摄像头分辨率
msgbox(11111)
Dim camw As Integer = pic.Image.Width
Dim camh As Integer = pic.Image.Height
\'截取框和预览框比例
msgbox(222)
Dim cw As Double = camw / w
Dim ch As Double = camh / h
\'计算截图坐标
msgbox(3333332)
Dim picx As Integer = CInt(CDbl(x1-x) * cw)
Dim picy As Integer = CInt(CDbl(y1-y) * ch)
Dim picw As Integer = CInt(CDbl(w1) * cw)
Dim pich As Integer = CInt(CDbl(h1) * ch)
\'截取图片
pic2.Image = Functions.Execute("GetBitmapPart",_Cap.GetBitmap(),picx,picy,picw,pich)
\'输入信息
e.Form.Controls("ViewSize").Text = "预览框尺寸:[" & w & "*" & h & "]"
e.Form.Controls("BoxSize").Text = "截图框尺寸:[" & w1 & "*" & h1 & "]"
e.Form.Controls("PicSize").Text = "照片尺寸:[" & picw & "*" & pich & "]"
e.Form.Controls("CamSize").Text = "摄像头分辨率:[" & camw & "*" & camh & "]"
e.Form.Controls("ZoomRate").Text = "缩放比:[" & cw & ":" & ch & "]"