下面这样的代码u pload函数是正常的,不知上面的代码为什么运行到u pload就报失败
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 ftp1 As New FtpClient
ftp1.Host="172.16.1.1"
ftp1.Account = "admin"
ftp1.Password = "Admin"
ftp1.UTF8=True
If Tables("自助报障记录表").Current.IsNull("问题描述附件")=False Then
If ftp1.D eleteFile("\各表附件\自助报障记录表\" & CurrentTable.Current("问题描述附件")) = True Then
Messagebox.show("截图删除完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("截图删除失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End If
Dim str_serialno As String = e.Form.Controls("TB_日常问题ID").value & "_" & Format(Date.now, "yyMMddhhmmss") & ".jpg"
bit.save(ProjectPath & "RemoteFiles\" & str_serialno) '保存图片到本地
'上传到FTP服务器
If ftp1.upload(ProjectPath & "RemoteFiles\" & str_serialno,"\各表附件\自助报障记录表\" & str_serialno)= True Then
Messagebox.show("截图上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("截图上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
ftp1.close
'MessageBox.show(1)
Tables("自助报障记录表").Current("问题描述附件")= str_serialno '在"自助报障记录表"中保存上述图片路径
Tables("自助报障记录表").current.Save
MessageBox.Show("截图成功!", "提示",MessageBoxButtons.Ok,MessageBoxIcon.Question, 0, Windows.forms.MessageBoxOptions.ServiceNotification) '模态窗口提示
Dim pbx As WinForm.PictureBox= Forms("软件自助报障系统窗口").Controls("PictureBox1")
pbx.SizeMode = ImageSizeMode.Zoom
pbx.Image = GetImage(ProjectPath & "RemoteFiles\" & str_serialno)