Sheldon1874 发表于 2016-4-2 11:21:39

URI超链接-为什么这不起作用?

嗨,
尝试超链接到本地驱动器jpg。 为什么下面不起作用?
            
                Dim txtDB As New DBText()
                Dim strTxt As String = sFname
                txtDB.SetDatabaseDefaults()
                Dim hyperlinkColl As HyperLinkCollection = txtDB.Hyperlinks
                Dim hyperL As HyperLink = New HyperLink
                Dim uri As New System.Uri(fname)
                Dim convertUri = uri.AbsolutePath.ToString
                hyperL.Description = "Photograph"
                hyperL.Name = "Photograph"
                hyperL.SubLocation = convertUri
                hyperlinkColl.Add(hyperL)
                txtDB.Position = pt.Position
                txtDB.TextString = strTxt
                txtDB.Justify = AttachmentPoint.BaseLeft
                txtDB.AdjustAlignment(db)
                btr.AppendEntity(txtDB)
                tr.AddNewlyCreatedDBObject(txtDB, True)
                tr.Commit()
谢谢。
**** Hidden Message *****

gile 发表于 2016-4-2 11:52:33

嗨,在将超链接添加到数据库文本之前,尝试完成将数据库文本添加到数据库。    Dim txt db As New db text()。
Dim strTxt As String = SF name 。
txtDB,setdatabasefaults()。

txtDB,位置=点,位置。
txtDB,TextString = strTxt。
txtDB,Justify = AttachmentPoint,BaseLeft。
txtDB,AdjustAlignment(db)。

btr,AppendEntity(txtDB)。
trAddNewlyCreatedDBObject(txtDB,True)。

Dim hyperlink coll As hyperlink collection = txt db,超链接。
Dim hyperL As HyperLink = New HyperLink 。
Dim uri作为新系统,Uri(fname)。
Dim convertUri = uri,AbsolutePath.ToString。

hyperL,Description = "Photograph"。
hyperL,Name = "Photograph"。
hyperL,SubLocation = convertUri。
hyperlinkColl,添加(hyperL)。

trCommit()。

Sheldon1874 发表于 2016-4-2 15:52:56

是啊,当然要把那东西加到数据库里,然后摆弄它。接下来的问题就在这里解决了:http://adndevblog . typepad . com/AutoCAD/2012/05/how-to-create-a-hyperlink-on-an-entity . html .使用hyperl.name而不是hyperl.sublocation.
谢谢
页: [1]
查看完整版本: URI超链接-为什么这不起作用?