pqy_20一风
路人甲
路人甲
  • 注册日期2004-08-05
  • 发帖数52
  • QQ
  • 铜币418枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1761回复:1

C#+AE,如何使用IMapFrame的CreateSurroundFrame方法?

楼主#
更多 发布于:2007-01-24 18:20
<P>VB中:  Dim pMapFrame As IMapFrame<BR>       Dim pMapSurroundF As IMapSurroundFrame<BR>       Dim pUID As New UID<BR>       pUID.Value = "esriCore.ScaleText"<BR>       Set pMapFrame = pActiveView.GraphicsContainer.FindFrame(frmLayout.PageLayoutControl1.ActiveView.FocusMap)</P>
<P>       Set pMapSurroundF = pMapFrame.CreateSurroundFrame(pUID, Nothing)</P>
<P><BR>C#中改为 pMapSurroundF = pMapFrame.CreateSurroundFrame(pUID,null);</P>
<P>  提示错误: 与“ESRI.ArcGIS.Carto.IMapFrame.CreateSurroundFrame(ESRI.ArcGIS.esriSystem.UID, ESRI.ArcGIS.Carto.IMapSurround)”最匹配的重载方法具有一些无效参数</P>
喜欢0 评分0
fisherssj
路人甲
路人甲
  • 注册日期2004-06-29
  • 发帖数65
  • QQ
  • 铜币52枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-01-24 20:32
<PRE>看看EDN的例子吧:</PRE><PRE>public void AddMapSurround(IPageLayout docPageLayout, IMap docMap, IActiveView docActiveView)<BR>{<BR> IGraphicsContainer docGraphicsContainer;<BR> IMapFrame docMapFrame;<BR> docGraphicsContainer = docPageLayout as IGraphicsContainer;<BR> docMapFrame = (IMapFrame)docGraphicsContainer.FindFrame(docMap);<BR> IMapSurroundFrame docMapSurroundFrame;<BR> docMapSurroundFrame= new MapSurroundFrameClass();</PRE><PRE> UID elementUID;<BR> elementUID = new UIDClass();<BR> IElement docElement;<BR> //The value determines the type of MapSurroundFrame being added.<BR> elementUID.Value = "esriCarto.Legend";<BR> //The createsurroundframe method takes the UID of the element and an optional style.<BR> docMapSurroundFrame= docMapFrame.CreateSurroundFrame(elementUID, null);<BR> docMapSurroundFrame.MapSurround.Name = "Legend";<BR> //Now cast the MapSurroundFrame as an element so it can be inserted into the page layout.<BR> docElement = docMapSurroundFrame as IElement;<BR> IElement MainMapElement;<BR> IEnvelope MainEnv;<BR> MainMapElement = docMapFrame as IElement;<BR> MainEnv = MainMapElement.Geometry.Envelope;<BR> IEnvelope Env;<BR> Env = new EnvelopeClass();<BR> Env.PutCoords(MainEnv.XMax + 1.5, MainEnv.YMin + 1.5, MainEnv.XMax - 1.5, MainEnv.YMax - 1.5);<BR> docElement.Geometry = Env;<BR> docElement.Activate(docActiveView.ScreenDisplay);<BR> docGraphicsContainer.AddElement(docElement, 0);<BR> docActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);<BR>}</PRE>
这个世界究竟是什么样子?
举报 回复(0) 喜欢(0)     评分
游客

返回顶部