private void AddLegend(IActiveView pActiveView, IEnvelope pEnv)
{
IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
UID pID = new UID();
pID.Value = "esriCarto.Legend";
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pActiveView.FocusMap) as IMapFrame;
IMapSurroundFrame pMapSurroundFrame = pMapFrame.CreateSurroundFrame(pID, null);//根据唯一标示符,创建与之对应MapSurroundFrame
IElement pDeletElement = axPageControl.FindElementByName("Legend");//获取PageLayout中的图例元素
if (pDeletElement != null)
{
pGraphicsContainer.DeleteElement(pDeletElement); //如果已经存在图例,删除已经存在的图例
}
//设置MapSurroundFrame背景
ISymbolBackground pSymbolBackground = new SymbolBackgr
{
IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
UID pID = new UID();
pID.Value = "esriCarto.Legend";
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pActiveView.FocusMap) as IMapFrame;
IMapSurroundFrame pMapSurroundFrame = pMapFrame.CreateSurroundFrame(pID, null);//根据唯一标示符,创建与之对应MapSurroundFrame
IElement pDeletElement = axPageControl.FindElementByName("Legend");//获取PageLayout中的图例元素
if (pDeletElement != null)
{
pGraphicsContainer.DeleteElement(pDeletElement); //如果已经存在图例,删除已经存在的图例
}
//设置MapSurroundFrame背景
ISymbolBackground pSymbolBackground = new SymbolBackgr