Dim zpk1 As WinForm.PictureBox = e.Form.Controls("照片")
Dim tbl As WinForm.TabControl = e.Form.Controls("TabControl1")
Dim ylk As WinForm.Panel = e.Form.Controls("预览框")
Dim zs As WinForm.Button = e.Form.Controls("左上")
Dim yx As WinForm.Button = e.Form.Controls("右下")
Dim sx As WinForm.Line = e.Form.Controls("上线")
Dim zx As WinForm.Line = e.Form.Controls("左线")
'计算截图框坐标
Dim bl_w As Double = 640 / ylk.Width '比例
Dim bl_h As Double = 480 / ylk.Height ,比例
Dim x As Integer = Math.Abs(zs.Left-ylk.left) * bl_w
Dim y As Integer = Math.Abs(zs.Top-ylk.Top) * bl_h
Dim w As Integer = sx.Width * bl_w
Dim h As Integer = zx.Height * bl_h
_Cap.GrapImg()
Dim zp As Bitmap
zp = Functions.Execute("截图",_Cap.GetBitmap(),x,y,w,h)
'zp = Functions.Execute("截图",_Cap.GetBitmap(),0,0,469,361)
zpk1.Image = zp
If zpk1.Image IsNot Nothing Then
e.Form.Controls("上下翻转").Enabled = True
e.Form.Controls("水平翻转").Enabled = True
e.Form.Controls("顺转90").Enabled = True
e.Form.Controls("逆转90").Enabled = True
e.Form.Controls("保存照片").Enabled = True
e.Form.Controls("删除照片").Enabled = True
e.Form.Controls("文件名").text = "pz" & Format(Date.Now,"yyyyMMddHHmmss") & ".jpg"
e.Form.Controls("拍摄时间").text = Date.Now
e.Form.Controls("分辨率").text = w & "*" & h
End If
'保存为临时文件
Dim Img As Image = zpk1.Image
Dim path As String = ProjectPath & "Reports"
If FileSys.DirectoryExists(path) = False Then
FileSys.CreateDirectory(path)
End If
Img.save(Path & "\temp.jpg") '保存临时图片
'获取图片信息
Dim ifo As new FileInfo(Path & "\temp.jpg")
If Ifo.Length > 1024*1024
e.Form.Controls("大小").text =Round2(Ifo.Length/(1024*1024),1) & "MB"
ElseIf Ifo.Length > 1024
e.Form.Controls("大小").text =Round2(Ifo.Length/1024,1) & "KB"
Else
e.Form.Controls("大小").text =Ifo.Length & "Btye"
End If
zpk1.SizeMode = ImageSizeMode.StretchImage
最后加一句也不行