Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PagelayoutControl with the name: PageControl. And I added a text element into MapFrame (FocusMap) of the PagelayoutControl. If the text element and MapFrame are selected (by using the button "Select Elements" on the toolbar).

Do you know are there any ways to unselect the elements and MapFrame by using code in C# ?

Please see my screenshots (in cases: selected and unselected)

enter image description here

enter image description here

Thanks and regards,

share|improve this question
up vote 2 down vote accepted

QI from IMapFrame.Map to IGraphicsContainerSelect and call its UnselectAllElements or UnselectElement methods.

share|improve this answer
Thank you. But when elements are selecting. I can't find the MapFrame object of PageLayoutControl. I use the statement: IElement pElement = graphicsContainer.Next(); to find elements. (with graphicsContainer = pageControl.ActiveView.GraphicsContainer;) – taibc Nov 14 '12 at 3:40
Hi blah238. I can do now, I used another statement : graphicsContainer = PageControl.PageLayout as IGraphicsContainer – taibc Nov 14 '12 at 4:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.