以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  双击截图保存  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=158210)

--  作者:yifan3429
--  发布时间:2020/11/11 15:33:00
--  双击截图保存
  
启动截图功能,勾选截图软件的勾选确认后,将截图按照路劲保存到图片列
(路径如:基建\\T1\\A\\墙面系统\\双面9厘板木龙骨隔墙(2020-11-11-00-00).jpg)

If e.Col.name = "图片" Then
    Dim dr As DataRow = e.Row.DataRow
    If dr.IsNull ("区域名称") Or Dr.IsNull("立面编号")  Or Dr.IsNull("类别") Or Dr.IsNull("施工项目")  Then
        MessageBox.show("带 * 为必填","提示")
        e.cancel = True
    Else
        baseMainForm.WindowState= system.Windows.forms.FormWindowState.Minimized
        ClipBoard.Clear
        Dim proc As new Process
        proc.File = ApplicationPath & "/capture.exe"
        proc.WaitForClose = True
        proc.Start()

接下来这个如何保存截图内容


   End If     
End If

[此贴子已经被作者于2020/11/11 15:49:01编辑过]

--  作者:有点蓝
--  发布时间:2020/11/11 15:47:00
--  
……
        proc.WaitForClose = True
        proc.Start()
        If ClipBoard.ContainsImage Then
    Dim img As Image
    img = ClipBoard.GetImage()
Dim f As String =   e.Row("区域名称") & "\\" & e.Row("立面编号") &"\\" & e.Row("类别")&"\\" & e.Row("施工项目")&".png"
img.save(projectpath & "Attachments\\" & f)
e.row("图片") = f
End If
    End If
End If

--  作者:yifan3429
--  发布时间:2020/11/11 16:11:00
--  
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:基建,DoubleClick
详细错误信息:
GDI+ 中发生一般性错误。

If e.Col.name = "图片" Then
    Dim dr As DataRow = e.Row.DataRow
    If dr.IsNull ("区域名称") Or Dr.IsNull("立面编号")  Or Dr.IsNull("类别") Or Dr.IsNull("施工项目")  Then
        MessageBox.show("带 * 为必填","提示")
        e.cancel = True
    Else
        baseMainForm.WindowState= system.Windows.forms.FormWindowState.Minimized
        ClipBoard.Clear
        Dim proc As new Process
        proc.File = ApplicationPath & "/capture.exe"        
        proc.WaitForClose = True
        proc.Start()
        If ClipBoard.ContainsImage Then
            Dim img As Image
            img = ClipBoard.GetImage()
            Dim f As String =   e.Row("区域名称") & "\\" & e.Row("立面编号") &"\\" & e.Row("类别")&"\\" & e.Row("施工项目")&".png"
            img.save(projectpath  &"\\\\Vce\\toda$\\数据文件\\"& f)
            e.Row("图片") = f
        End If
    End If
End If

--  作者:有点蓝
--  发布时间:2020/11/11 16:13:00
--  
路径不正确,
msgbox(projectpath  &"\\\\Vce\\toda$\\数据文件\\"& f)

如果是共享目录,应该这样:img.save("\\\\Vce\\toda$\\数据文件\\"& f)

--  作者:yifan3429
--  发布时间:2020/11/11 16:40:00
--  
 If ClipBoard.ContainsImage Then
            Dim img As Image
            img = ClipBoard.GetImage()
            Dim f As String = "基建"  & "\\" &  dr("区域名称") &  "\\" &  dr("立面编号") &  "\\" & dr("类别")
            img.save("\\\\Vce\\toda$\\数据文件\\"& f)
            e.Row("图片") = f
        End If


还是不行,同样错误
[此贴子已经被作者于2020/11/11 16:40:22编辑过]

--  作者:有点蓝
--  发布时间:2020/11/11 16:50:00
--  
路径还是不正确,注意路径中的每个目录都必须预先创建好
msgbox("\\\\Vce\\toda$\\数据文件\\"& f)

或者没有权限写入共享目录

--  作者:yifan3429
--  发布时间:2020/11/11 17:10:00
--  
单独通过图片的的列功能是可以操作的,共享路劲是对的,后面的是合成的时候创建的
--  作者:有点蓝
--  发布时间:2020/11/11 17:12:00
--  
试试保存到本机一个简单的路径

img.save("c:\\abc.jpg")

--  作者:yifan3429
--  发布时间:2020/11/11 19:00:00
--  
也是不行,老师
--  作者:有点蓝
--  发布时间:2020/11/12 9:17:00
--  
我在命令窗口这样测试没有问题

baseMainForm.WindowState= system.Windows.forms.FormWindowState.Minimized
ClipBoard.Clear
Dim proc As new Process
proc.File = ApplicationPath & "/capture.exe"
proc.WaitForClose = True
proc.Start()
If ClipBoard.ContainsImage Then
    Dim img As Image
    img = ClipBoard.GetImage()
    img.save("c:\\abc.jpg")
End If

e.cancel = True换个位置试试,如:

If e.Col.name = "图片" Then
        e.cancel = True
    Dim dr As DataRow = e.Row.DataRow
    If dr.IsNull ("区域名称") Or Dr.IsNull("立面编号")  Or Dr.IsNull("类别") Or Dr.IsNull("施工项目")  Then
        MessageBox.show("带 * 为必填","提示")
    Else
        baseMainForm.WindowState= system.Windows.forms.FormWindowState.Minimized
        ClipBoard.Clear
……