// Double-click to modify the map element.
Private void axpagelayoutcontrolpolicondoubleclick (Object sender, ipagelayoutcontrolevents_ondoubleclickevent E)
{
Try
{
If (ppagelayoutcontrol. currenttool! = NULL & ppagelayoutcontrol. currenttool! = Commonprintclass. pcommand)
{
Return;
}
Ipoint Ppoint = ppagelayoutcontrol. activeview. screendisplay. displaytransformation. tomappoint (E. X, E. y );
Igraphicscontainer pgraphicscontainer = ppagelayoutcontrol. pagelayout as igraphicscontainer;
Igraphicscontainerselect pgraphicscontainerselect = ppagelayoutcontrol. pagelayout as igraphicscontainerselect;
Ienumelement penumelement = pgraphicscontainer. locateelements (Ppoint, 1 );
Penumelement. Reset ();
Ielement pelement = penumelement. Next ();
While (pelement! = NULL)
{
If (pelement is imapframe)
{
Pelement = penumelement. Next ();
Continue;
}
Ielement pnewelement = modifymapelement (pelement );
If (pnewelement! = NULL)
{
If (pelement is imapsurroundframe) // The memory error is reported when you delete an imapsurround object (for example, baseline, or scale) from the template.
{
Imapsurroundframe pmapsf = pelement as imapsurroundframe;
Imapsurround pmapsurround = pmapsf. mapsurround;
If (pmapsurround is imarkernortharrow | pmapsurround is ilegend | pmapsurround is iscalebar | pmapsurround is iscaletext)
{
IMAP pmap = ppagelayoutcontrol. activeview. focusmap;
Pmapsurround. Map = pmap;
Pmap. deletemapsurround (pmapsurround );
Ppagelayoutcontrol. Refresh (esriviewdrawphase. esriviewgraphics, null, null );
}
If (pelement! = NULL)
{
Pgraphicscontainer. deleteelement (pelement );
}
}
Else
{
Pgraphicscontainer. deleteelement (pelement );
}
Pgraphicscontainer. addelement (pnewelement, 0 );
Pgraphicscontainerselect. selectelement (pnewelement );
Ppagelayoutcontrol. activeview. partialrefresh (esriviewdrawphase. esriviewgraphics, null, null );
Break;
}
Else
{
Return;
// Break;
}
}
}
Catch
{
}
}