aviabunin

How to define that Element is selected?

Discussion created by aviabunin on Feb 21, 2012
Latest reply on Feb 22, 2012 by aviabunin
Hi, gurus!
arcgis engine 2010 in .NET
I have some circleElements on Map. And one of them is selected. How I can to define - what element is selected?
I use code:
        
public void CountGraphicElements(IMap map)
        {
            IGraphicsContainer graphicsContainer = map as IGraphicsContainer;

            //Reset the container to start from the beginning.
            graphicsContainer.Reset();
            Int32 int32_Counter = 0;
            IElement element = graphicsContainer.Next();

            //Loop through the container until the end, denoted by a null value.
            while (element != null)
            {
                //Test the element to see if it's a certain type. This can be ITextElement, IPolygonElement, etc.
                if (element is ICircleElement)
                {
                    //If a match is found, increment the counter.
                    if (element.SelectionTracker.ShowHandles == true)
                    {
                        element.SelectionTracker.Deactivate();
                        string s = element.SelectionTracker.ShowHandles.ToString();
                        string s1 = element.SelectionTracker.Locked.ToString();
                        int32_Counter = int32_Counter + 1;
                        MessageBox.Show("?????? X = " + element.Geometry.Envelope.XMin.ToString()+
                            " s = "+s+ " locked = "+ s1);
                    }
                }

                //Step to the next element in the container.
                element = graphicsContainer.Next();
            }

            //Display the results of the count.
            MessageBox.Show("The pagelayout contains " + int32_Counter +
                " CircleElement(s)");

Thanks in advance!

Outcomes