以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  未将对象引用设置  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=117609)

--  作者:刘林
--  发布时间:2018/4/16 10:01:00
--  未将对象引用设置
ftp1.Passw= 
messagebox.show("1")
Dim r As Row = Tables("学生信息").Current
messagebox.show("2")
If ValidPIN(r("身份证件号"))= True
    Dim dlg As New OpenFileDialog
    dlg.Filter= "图像文件|*.bmp;*.jpg;*.png;*.gif"
    If dlg.ShowDialog = DialogResult.OK Then
        Dim ifo As new FileInfo(dlg.filename)
        Dim img As image = getimage(dlg.filename)
        Dim bmp As new bitmap(img.width, img.height)
        Dim g = graphics.fromimage(bmp)
        g.DrawImage(img, 0, 0, img.Width, img.Height)
        Dim jpgEncoder As ImageCodecInfo
        Dim codecs() As ImageCodecInfo = ImageCodecInfo.GetImageDecoders
        For Each codec As ImageCodecInfo In codecs
            If (codec.FormatID = ImageFormat.Jpeg.Guid) Then
                jpgEncoder = codec
                Exit For
            End If
        Next
        Dim myEncoder As System.Drawing.Imaging.Encoder = System.Drawing.Imaging.Encoder.Quality
        Dim myEncoderParameters As EncoderParameters = New EncoderParameters(1)
        Dim myEncoderParameter As EncoderParameter = New EncoderParameter(myEncoder, 10) \' 质量级别 0 对应于最大压缩,而质量级别 100 对应于最小压缩
        myEncoderParameters.Param(0) = myEncoderParameter
        messagebox.show("3")
        Dim slt As String =  ifo.path & r("身份证件号") & ifo.Extension
        bmp.Save(slt,jpgEncoder, myEncoderParameters)
        bmp.dispose
        g.dispose
        messagebox.show("4")
        \'Dim file As String = "d:\\test.jpg"
        Dim img1 As image = getImage(slt)
        Dim bmp1 As bitmap
        If img1.width > 200 Then
            If 200 * (img1.height / img1.width) > 150 Then
                bmp1 = new bitmap(img1, 200*(150/(200*(img1.height/img1.width))), 150)
            Else
                bmp1 = new bitmap(img1, 150, 150 * (img1.height / img1.width))
            End If
        End If
        messagebox.show("5")
        bmp1.save(slt)
        bmp1.Dispose
        messagebox.show("6")
        If ftp1.Upload(slt,"\\xp\\" & FileSys.GetName(r("身份证件号") & Ifo.extension),True) = True Then
            \'   Messagebox.show("文件上传完成,请正确填写资料信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
            r("相片")="\\xp\\" & FileSys.GetName(r("身份证件号") & Ifo.extension)
            r.save
        Else
            Messagebox.show("上传失败,请重新上传该文件!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        End If
    End If
    messagebox.show("7")
Else
    MessageBox.show("请注意,该学生的身份证件号不正确或不存在,请确定身份证件号后重新上传相片")
End If


在5后6前出现
.NET Framework 版本:2.0.50727.8000
Foxtable 版本:2018.3.3.1
错误所在事件:窗口,学生信息x,Button10,Click
详细错误信息:
未将对象引用设置到对象的实例。
之前好像没这个问题,是什么原因?

--  作者:有点甜
--  发布时间:2018/4/16 10:16:00
--  

写在判断里面

 

        If img1.width > 200 Then

            If 200 * (img1.height / img1.width) > 150 Then
                bmp1 = new bitmap(img1, 200*(150/(200*(img1.height/img1.width))), 150)
            Else
                bmp1 = new bitmap(img1, 150, 150 * (img1.height / img1.width))
            End If
            bmp1.save(slt)
            bmp1.Dispose
        End If
 

--  作者:刘林
--  发布时间:2018/4/16 12:04:00
--  
谢谢!还有问题:
Dim rm As  New prt.RenderImage()
    rm.Image= GetImage(projectPath & "remotefiles" & r("相片"))
    rm.Width=25
    rm.Height=45
    rm.Y = 5
    rm.x=47
    ra.Children.Add(rm) \'添加到容

这是显示下载到本地的文件,我的问题是在其他电脑上传到ftp上的文件,现在另一台脑上直接打印,就没有下载,如何能直接打印远程的文件?

--  作者:有点甜
--  发布时间:2018/4/16 12:07:00
--  
以下是引用刘林在2018/4/16 12:04:00的发言:
 

这是显示下载到本地的文件,我的问题是在其他电脑上传到ftp上的文件,现在另一台脑上直接打印,就没有下载,如何能直接打印远程的文件?

 

先用ftp.download下载文件,然后再应用图片

 

http://www.foxtable.com/webhelp/scr/1410.htm

 


--  作者:刘林
--  发布时间:2018/4/16 13:37:00
--  
我的问题就是在于不下载如何显示,因为如果打印比较多,完全下载那不就占用本地空间了?
--  作者:有点甜
--  发布时间:2018/4/16 15:01:00
--  
以下是引用刘林在2018/4/16 13:37:00的发言:
我的问题就是在于不下载如何显示,因为如果打印比较多,完全下载那不就占用本地空间了?

 

需要显示的,必须下载,你可以下载后显示后,删除对应文件/文件夹