嗨,
有超链接问题....我目前正在做的程序将获取用户文本等,并在模型空间中插入一个预先制作的模型空间标记块,以指示所选布局指向的位置 - 它还应该添加指向所选布局的超链接(到标记块),以便用户可以跳转到该布局。
一切都很好,只是超链接部分,我现在必须工作。检查超链接编辑器后,每当您手动将超链接添加到布局时,要显示的路径,url和文本看起来都像它们应该的那样 - 即使在此绘图页面的目标或视图上,它也会突出显示正确的布局,但它不会跳转到布局,而是打开一个Windows资源管理器窗口到绘图路径目录。
如果我打开超链接编辑器,正如我所说,它看起来都很好,并且由于某种原因,如果我单击“确定”,那么这次再次尝试链接是有效的,但前提是我这样做,否则它只会打开资源管理器。
以下是程序代码的摘录。有人可以看看可能出了什么问题,或者让我知道为什么链接不能100%工作。
- Option Explicit
- Dim response As Integer 'Yes/No..
- Dim layoutX, layoutY As AcadLayout 'Acad Layout..
- Dim layoutZ As String
- Dim blockX As AcadBlockReference 'Inserted block..
- Dim blockPoint As Variant ' Pick point for block insert..
- Dim attribZ As Variant ' Attributes for inserted block..
- Dim countx As Integer 'Counter for getting attributes..
- Dim EntX As AcadEntity 'Acad Object (Block search for dblclick listbox)..
- Dim Hyp As AcadHyperlink 'Add hyperlink to block..
- Dim HypS As AcadHyperlinks 'Hyperlinks collection for block..
- '********************************************
- '************** INSERT BLOCK ****************
- '********************************************
- Private Sub insertmarkerBTN_Click()
- ' Check if all information is present..
- If DetDesc1TXT.Text = "" Then
- MsgBox "Please enter the main Detail title..", vbExclamation, "ModelSpace Detail Marker.."
- Exit Sub
- End If
- ' Check if all information is present..
- If drawnumTXT.Text = "" Then
- MsgBox "Please enter the main Drawing Number (or select it from the list)..", vbExclamation, "ModelSpace Detail Marker.."
- Exit Sub
- End If
- ModelDetailRefFRM.Hide
- ThisDrawing.ActiveSpace = acModelSpace
- 'Get pick point..
- 'Error Test for GetPoint method..
- On Error Resume Next
- TryAgainX:
- blockPoint = ThisDrawing.Utility.GetPoint(, vbCr & "Pick the insertion point for the Detail Reference Marker.. ")
- ErrHndlrX:
- If Err.Number 0 Then
- Err.Clear
- GoTo TryAgainX
- End If
- On Error GoTo ErrHndlrX
- 'Insert block..
- Set blockX = ThisDrawing.ModelSpace.InsertBlock(blockPoint, "X:\AbiCAD Blocks\General\Detail Reference - MSpace.dwg", 1#, 1#, 1#, 0)
- blockX.Layer = "X-Notes"
- ' Get and edit attributes..
- attribZ = blockX.GetAttributes ' Get Block attributes..
- ' Loop through attributes..
- For countx = LBound(attribZ) To UBound(attribZ)
- Select Case attribZ(countx).TagString
- Case "DRAWING_NUMBER"
- attribZ(countx).TextString = drawnumTXT.Text
- Case "DETAIL_NUMBER"
- attribZ(countx).TextString = detnumTXT.Text
- Case "DETAIL_DESC_1"
- attribZ(countx).TextString = DetDesc1TXT.Text
- Case "DETAIL_DESC_2"
- attribZ(countx).TextString = DetDesc2TXT.Text
- End Select
- Next countx
- [color=red]' Add the Hyperlink to the block to link back to the Layout..
- Set HypS = blockX.Hyperlinks
- ' Add a new Hyperlink complete with all properties
- Set Hyp = HypS.Add(LayoutLIST.Text)
- Hyp.URL = "#," & layoutZ
- Hyp.URLNamedLocation = "," & layoutZ[/color]
- blockX.Update
- ModelDetailRefFRM.Show
- End Sub
- '********************************************
- '************** INSERT BLOCK ****************
- '********************************************
有什么想法吗?
干杯,
保罗
基地点设计zltd..
P4 3.0Ghz / 2GB 内存.
XP Pro SP2..
蓝宝石 X1950 512MB 双 DVi 显卡.
AutoCAD 2008..
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |