private void axTOCControl1_ (  sender, ESRI.ArcGIS.Controls.ITOCControlEvents_ Event e)
        {
             esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap map = null;     = null;
              other = null;   index = null;
            this.axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref  , ref other, ref index);
            if (e.button == 1) {
                if (item == esriTOCControlItem.esriTOCControlItem )
                {

                    IFeature   S;
                     S =   as IFeature ;

                    int feature Index = -1;
                    for (int i = 0; i < axMapControl1.Map. Count; i++)
                    {
                        string  _name = axMapControl1.Map.get_ (i).Name.ToString();
                        if ( _name ==  S.Name)
                        {
                            feature Index = i;

                        }
                    }
                    MessageBox.Show( S.Name + \"图层的索引是:\" + feature Index);

                }
            }
        }

\"\" 

 

收藏 打印