如何使用程序获取或新建一个arcmap对象
- 产品教程
- 2007-09-15
- 203热度
- 0评论
在GIS应用中,Arcmap的有些功能在 ArcEngine并不好使,那么使用arcmap进行批处理对于数据处理挺有用的。可是如何在程序中捕获一个已经打开的Arcmap呢?过程下面代码所示:
Dim app As IApplication = Nothing
Dim appRot As New AppROT
'寻找打开的ArcMap
For i As Integer = 0 To appRot.Count - 1
If TypeOf appRot.Item(i) Is IMxApplication Then
app = appRot.Item(i)
Exit For
End If
Next
'找不到就新建一个
If app Is Nothing Then
Dim pDoc As IDocument = New MxDocument
app = pDoc.Parent
app.Visible = True
End If