以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  移动开发路径问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=111732)

--  作者:y70l12d12
--  发布时间:2017/12/28 15:14:00
--  移动开发路径问题
HttpRequest事件代码:

\'头文件
Dim fl As String = "c:\\web\\" & e.path
If filesys.FileExists(fl)
    Dim idx As Integer = fl.LastIndexOf(".")
    Dim ext As String  = fl.SubString(idx)
    Select Case ext
        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
            e.WriteFile(fl)
            Return \'这里必须返回
    End Select
End If
\'代码生成条码图片
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Bar.Code = "123456"
Bar.BarRatio = 3
Bar.BarHeight = 8
Bar.QuietZoneWidth = 5
Bar.DisplayCode = False
Bar.CodeAlignment = Barpro.Alignment.BelowRight
Bar.TextAlignment = Barpro.Alignment.AboveLeft
Bar.SaveImage("./images/条码.jpg")
\'网页浏览图片
Select Case e.Path
    Case "test.htm"
        Dim wb As New weui
        wb.AddForm("","form1","test.htm")
        With wb.AddInputGroup("form1","ipg1","条码测试")
            With .AddUploader("up1","",True)
                .AllowAdd = False \'关闭文件上传功能
                .AddImage("./images/条码.jpg")
            End With
        End With
        e.WriteString(wb.Build) \'生成网页
End Select

问题:两种颜色代码相同,但对应路径却不一样

1、绿色: C:\\Windows\\SysWOW64\\images
2、兰色:c:\\web\\images

绿色部分如何使用相对路径?

--  作者:有点甜
--  发布时间:2017/12/28 15:25:00
--  

单独定义一个变量

 

Dim fl1 As String = "c:\\web"

 

然后代码,改成

 

Bar.SaveImage(fl1 & "/images/条码.jpg")

 

------------------或者你的 Dim fl As String = "c:\\web\\" & e.path

 

改成 Dim fl As String = projectPath & "web\\" & e.path