Unable to call IGraphicsContainer.LocateElements() in MxDocument_OpenDocument event to get PageLayout elements.
上次发布: April 6, 2018ArcGIS for Desktop
漏洞 ID 编号
NIM063686
已提交
December 18, 2010
上次修改时间
June 5, 2024
适用范围
ArcGIS for Desktop
找到的版本
10.0
编程语言
VBA
状态
Will Not Be Addressed
开发团队已考虑过该问题或请求,并决定不会解决该问题。 问题的“其他信息”部分可能包含进一步说明。
附加信息
Currently, we have no plans to address this issue.
解决办法
' Remove or comment-out the line
' Set pEnumElement = pGraphicsContainer.LocateElements(pPoint, 0.2)
' as it will be inside the Do Loop of this workaround as shown below:
Set pEnumElement = Nothing
lngCounter = 0
Do While pEnumElement Is Nothing
Set pEnumElement = pGraphicsContainer.LocateElements(pPoint, 0.2)
lngCounter = lngCounter + 1
Debug.Print lngCounter
'***************************************************************
'Using DoEvents here. Without DoEvents, pEnumElement is always
'Nothing and an endless loop will occur.
'***************************************************************
DoEvents
'********************************************************************
'This avoids endless loop whenever DoEvents is not used. This should
'not be needed with DoEvents, but is here in case DoEvents is removed,
'otherwise, endless loop occurs and document will never open.
'********************************************************************
If lngCounter > 100000 Then
Exit Function
MsgBox "Exit Function"
End If
Loop
'************************************************************************
'Alternatively to DoEvents, using MsgBox gives time for PageLayout
'elements to load. When user dismisses MsgBox, all elements have loaded.
'************************************************************************
'MsgBox "Adding stamp..."