function CreateSurround(pUID: UID; pEnv: IEnvelope; strName: string; pPageLayout: IPageLayout): IMapSurround;
var
pGraphicsContainer: IGraphicsContainer;
pActiveView: IActiveView;
pMapSurroundFrame: IMapSurroundFrame;
pMapSurround: IMapSurround;
pMapFrame: IMapFrame;
pElement : IElement;
pMap : IMap;
begin
pGraphicsContainer := pPageLayout as IGraphicsContainer;
pActiveView := pPageLayout as IActiveView;
pMap := pActiveView.FocusMap;
pMapFrame := pGraphicsContainer.FindFrame(pMap) as IMapFrame;
//当 地图框架 被删除后,必须做异常处理
if pMapFrame = nil then
Exit(nil);
pMapSurroundFrame := pMapFrame.CreateSurroundFrame(pUID, nil);
pMapSurroundFrame.MapSurround.Name := strName;
pElement := pMapSurroundFrame as IElement;
pElement.Geometry := pEnv as IGeometry;
pGraphicsContainer.AddElement(pElement, 0);
Result := pMapSurroundFrame.MapSurround;
end;