窗口1拍照按钮代码
If Tables("学籍表").Current IsNot Nothing AndAlso Tables("学籍表").Current.IsNull("学籍号") = False Then
If Tables("学籍表").Current.IsNull("相片") = False Then
If MessageBox.Show("该生已拍照,是否重拍?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) = DialogResult.No Then
Return
End If
End If
Forms("拍照").Show()
If Forms("拍照").Opened Then
Forms("拍照").Controls("FileName").Text = ProjectPath & "Attachments\" & Tables("学籍表").Current("学籍号") & ".JPG"
End If
End If
窗口2拍照按钮代码
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()
'摄像头分辨率
Dim camw As Integer = pic.Image.Width
Dim camh As Integer = pic.Image.Height
'截取框和预览框比例
Dim cw As Double = camw / w
Dim ch As Double = camh / h
'计算截图坐标
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 & "]"
你好, 我就差这最后一步了, 我想把两个照相按钮的代码合一起, 用一个按钮。 否则我需要点两个窗口的拍照按钮(需要点两下)。 请您帮我把两个代码合一起呗, 不知道我说明白没有,太感谢了