public Boolean DeleteDataFrame(string strDataFrameName)
{
IMxDocument iMxDoc = (IMxDocument) ArcMap.Application.Document;
ICommandBars iBar = ArcMap.Application.Document.CommandBars;
ICommandItem iItem;
UID uUID = new UIDClass();
try
{
for (int x = 0; iMxDoc.Maps.Count > x; x++)
{
if (iMxDoc.Maps.Item.Name == strDataFrameName)
{
iMxDoc.CurrentContentsView.ContextItem = iMxDoc.Maps.Item;
uUID.Value = "{F42891B6-2C92-11D2-AE07-080009EC732A}";
uUID.SubType = 9;
iItem = iBar.Find(uUID,false,false);
if (iItem != null)
{
iItem.Execute();
}
break;
}
}
}
catch
{
return false;
}
return true;
}