Foxtable(狐表)用户栏目专家坐堂 → 再帮我检查一下代码


  共有2776人关注过本帖树形打印复制链接

主题:再帮我检查一下代码

帅哥哟,离线,有人找我吗?
13796361423
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:179 积分:1932 威望:0 精华:0 注册:2020/2/14 18:49:00
再帮我检查一下代码  发帖心情 Post By:2020/9/30 15:00:00 [只看该作者]

窗口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 & "]"

 

 

你好, 我就差这最后一步了, 我想把两个照相按钮的代码合一起, 用一个按钮。 否则我需要点两个窗口的拍照按钮(需要点两下)。  请您帮我把两个代码合一起呗, 不知道我说明白没有,太感谢了 


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110813 积分:564003 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/9/30 15:05:00 [只看该作者]

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("照相按钮").PerformClick()
        Forms("拍照").Controls("FileName").Text = ProjectPath & "Attachments\" & Tables("学籍表").Current("学籍号") & ".JPG"
    End If
End If


 回到顶部