阅读:1761回复:1
C#+AE,如何使用IMapFrame的CreateSurroundFrame方法?
<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> |
|
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>
|
|
|