HOW TO

Remove a data frame from a map document using ArcObjects

Last Published: April 26, 2020

Summary

Instructions provided describe some sample code to remove a data frame from the page layout by calling the IGraphicsContainer::DeleteElement() method.

Procedure



  • [VB.NET]

    Code:
    Dim pMap As IMap = pMapDoc.Map(0)
    Dim pContainer As IGraphicsContainer = pMapDoc.PageLayout
    Dim pMapframe As IMapFrame = pContainer.FindFrame(pMap)
    pContainer.DeleteElement(pMapframe)

  • [C#]

    Code:
    IMap pMap = pMapDoc.get_Map(0);
    IGraphicsContainer pContainer = (IGraphicsContainer)pMapDoc.PageLayout;
    IMapFrame pMapframe = (IMapFrame)pContainer.FindFrame(pMap);
    pContainer.DeleteElement((IElement)pMapframe);

  • [JAVA]

    Code:
    IMap pMap = pMapDoc.getMap(0);
    IGraphicsContainer pContainer = (IGraphicsContainer)pMapDoc.getPageLayout();
    IMapFrame pMapframe = (IMapFrame)pContainer.findFrame(pMap);
    pContainer.deleteElement((IElement)pMapframe);

Article ID: 000013270

Software:
  • ArcObjects SDK for the Java Platform
  • ArcObjects SDK Microsoft NET Framework

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options