標籤:from article element mis style create put type ext
原文 AE+C# 向axPageLayoutControl1添加圖例
//Get the GraphicsContainerIGraphicsContainer graphicsContainer = axPageLayoutControl1.GraphicsContainer;//Get the MapFrameIMapFrame mapFrame = (IMapFrame)graphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap);if (mapFrame == null) return;//Create a legendUID uID = new UIDClass();uID.Value = "esriCarto.Legend";//Create a MapSurroundFrame from the MapFrameIMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uID, null);if (mapSurroundFrame == null) return;if (mapSurroundFrame.MapSurround == null) return;//Set the name mapSurroundFrame.MapSurround.Name = "Legend";//Envelope for the legendIEnvelope envelope = new EnvelopeClass();envelope.PutCoords(1, 1, 3.4, 2.4);//Set the geometry of the MapSurroundFrame IElement element = (IElement)mapSurroundFrame;element.Geometry = envelope;//Add the legend to the PageLayoutaxPageLayoutControl1.AddElement(element, Type.Missing, Type.Missing, "Legend", 0);//Refresh the PageLayoutControlaxPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
AE+C# 向axPageLayoutControl1添加圖例