Amin_GIS
路人甲
路人甲
  • 注册日期2006-03-03
  • 发帖数28
  • QQ
  • 铜币230枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2078回复:5

[讨论]关于往TOC中添加数据框

楼主#
更多 发布于:2008-11-22 18:44
<P>下面是一个添加数据框的VB代码,我想把它用到C#.NET+AE中,可老是翻译不对,尤其是前面几个接口根本就没有,不知如何替代,很是急躁,请大家发挥群众的智慧帮我解决一下,不胜感激!</P>
<P>Public Sub AddDataFrame()<BR> <BR>  Dim pContentsView As IContentsView<BR>  Dim pApp As IMxApplication<BR>  Dim pMap As IMap<BR>  Dim pMaps As IMaps<BR>  Dim pMxDocument As IMxDocument<BR>  Dim pActiveView As IActiveView<BR>  <BR>  Set pApp = Application<BR>  Set pMxDocument = ThisDocument<BR>  Set pActiveView = pMxDocument.ActiveView<BR>  Set pMaps = pMxDocument.Maps<BR>  Set pMap = pMaps.Create<BR>  <BR>  pMaps.Add pMap<BR> <BR>  Set pContentsView = pMxDocument.CurrentContentsView<BR>  pContentsView.Refresh pMxDocument<BR> <BR>  Dim pMapFrame As IMapFrame<BR>  Dim pMapExt As IEnvelope<BR>  <BR>  Set pMapFrame = New MapFrame<BR>  Set pMapExt = New Envelope<BR>  Set pMapFrame.Map = pMap<BR>  <BR>  pMapExt.XMin = 3<BR>  pMapExt.YMin = 3<BR>  pMapExt.XMax = 7<BR>  pMapExt.YMax = 7<BR>  <BR>  Dim pMapElement As IElement<BR>  Dim pGeoExt As IGeometry<BR>  <BR>  Set pMapElement = pMapFrame<BR>  Set pGeoExt = pMapExt<BR>  pMapElement.Geometry = pGeoExt<BR>  <BR>  If pActiveView.IsMapActivated Then<BR>    Set pMxDocument.ActiveView = pMap<BR>    Dim pGraphicsContainer As IGraphicsContainer<BR>    Set pGraphicsContainer = pMxDocument.PageLayout<BR>    pGraphicsContainer.AddElement pMapElement, 2<BR>  Else<BR>    pActiveView.GraphicsContainer.AddElement pMapElement, 2<BR>    pMapElement.Activate pApp.Display<BR>  End If<BR>  pActiveView.Refresh<BR>  <BR>End Sub<BR></P>
喜欢0 评分0
Amin_GIS
路人甲
路人甲
  • 注册日期2006-03-03
  • 发帖数28
  • QQ
  • 铜币230枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2008-11-23 13:05
<P><BR>             IGraphicsContainer pGraphicsContainer;<BR>             IMap pMap;<BR>             IActiveView pActiveView;</P>
<P>             pGraphicsContainer = axPageLayoutControl1.PageLayout as IGraphicsContainer;<BR>             pActiveView =axPageLayoutControl1.ActiveView;<BR>             pMap = axPageLayoutControl1.ActiveView.FocusMap;<BR>    <BR>             IMapFrame pMapFrame=new MapFrameClass();<BR>             IEnvelope pMapExt= new EnvelopeClass();;<BR>                <BR>             pMapFrame.Map = pMap;<BR>             pMapExt.PutCoords( 3, 3, 7, 7);<BR>    <BR>             IElement pMapElement; <BR>             IGeometry pGeoExt;</P>
<P>             pMapElement = pMapFrame as IElement;<BR>             pGeoExt = pMapExt;<BR>             pMapElement.Geometry = pGeoExt;</P>
<P>             pElement = pMapElement;</P>
<P>             pGraphicsContainer.AddElement (pMapElement, 1);<BR>             axPageLayoutControl1.Refresh();</P>
举报 回复(0) 喜欢(0)     评分
Amin_GIS
路人甲
路人甲
  • 注册日期2006-03-03
  • 发帖数28
  • QQ
  • 铜币230枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2008-11-23 13:08
<P>上面是在页面视图(Layout view)中添加数据框,不知如何在data view中添加数据框</P>
举报 回复(0) 喜欢(0)     评分
Amin_GIS
路人甲
路人甲
  • 注册日期2006-03-03
  • 发帖数28
  • QQ
  • 铜币230枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2008-11-25 13:30
<P>每次在帝国论坛里提问了问题,总是没人回答,真让人失望!</P><img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
4楼#
发布于:2008-11-27 15:48
<P>IMxApplication等接口只在arcgis desktop里有,所以你需要更换你的程序思路;</P>
<P>pagelayout可以使用arcgis engine里的pagelayout视图;</P>
<P>如果你要测试你上面的代码,可以在arcmap的vba里测试</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
Amin_GIS
路人甲
路人甲
  • 注册日期2006-03-03
  • 发帖数28
  • QQ
  • 铜币230枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2008-12-02 13:03
我是想在axMapControl里添加,麻烦指点一下吧,先谢过了!
举报 回复(0) 喜欢(0)     评分
游客

返回顶部