Dim myGraphics As Graphics = basemainform.CreateGraphics()
Dim s As new Size(2000, 1000) '截取的大小
Dim bit As New Bitmap(s.Width, s.Height, myGraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(bit)
memoryGraphics.CopyFromScreen(0, 0, 0, 0, s) '截取的开始位置,坐标(100, 200)
Dim str_serialno As String = e.Form.Controls("TB_日常问题ID").value & "_" & Format(Date.now, "yyMMddhhmmss") & ".jpg"
bit.save(ProjectPath & "RemoteFiles\" & str_serialno) '保存图片到本地
msgbox(ProjectPath & "RemoteFiles\" & str_serialno)
'上传到FTP服务器
Dim ftp1 As new ftpclient
ftp1.host="172.16.5.13"
ftp1.Account = "075"
ftp1.password = "075"
ftp1.upload(ProjectPath & "RemoteFiles\" & str_serialno,"/李朝阳/" & str_serialno,True) '上传
Tables("自助报障记录表").Current("问题描述附件")= str_serialno '在"自助报障记录表"中保存上述图片路径
Tables("自助报障记录表").current.Save
bit.Dispose() '丢弃资源,不知道是否起作用
MessageBox.Show("截图成功", "提示",MessageBoxButtons.Ok,MessageBoxIcon.Question, 0, Windows.forms.MessageBoxOptions.ServiceNotification) '模态窗口提示
Dim pbx As WinForm.PictureBox
pbx = Forms("软件自助报障系统窗口").Controls("PictureBox1")
pbx.SizeMode = ImageSizeMode.Zoom
pbx.Image = GetImage(ProjectPath & "RemoteFiles\" & str_serialno)