IGraphicsContainer graphics container = axpagelayoutcontrol 1。圖形容器;
IMAP frame map frame =(IMAP frame)graphics container。find frame(axpagelayoutcontrol 1。active view . focus map);
if (mapFrame == null)
返回;
UID UID = new UID class();
uID。Value = "esriCarto。圖例”;
IMapSurroundFrame mapSurroundFrame = map frame。CreateSurroundFrame(uID,null);
if (mapSurroundFrame == null)返回;
if (mapSurroundFrame。MapSurround == null)返回;
mapsurroundframe . map surround . name = " legend ";
IEnvelope envelope = new envelope class();
信封。PutCoords(1,1,3.4,2.4);
ie element element =(ie element)mapSurroundFrame;
元素。幾何=包絡;
axPageLayoutControl1。AddElement(元素,類型。缺失,類型。缺失,“0000”,0);
axPageLayoutControl1。active view . partial refresh(esriviewdrawphase . esriviewgraphics,null,null);