Esempio n. 1
0
        private void axTOCControl1_OnMouseUp(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnMouseUpEvent e)
        {
            if (e.button == 2)
            {
                IBasicMap          map   = null;
                ILayer             layer = null;
                object             other = null;
                object             index = null;
                esriTOCControlItem item  = esriTOCControlItem.esriTOCControlItemNone;

                axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);
                if (item == esriTOCControlItem.esriTOCControlItemLayer)
                {
                    if (layer is IAnnotationSublayer)
                    {
                        _curLayer = null;
                    }
                    else
                    {
                        _curLayer = layer;
                    }
                }
                else
                {
                    _curLayer = null;
                }

                PopupContextMenu(e.x, e.y);
            }
        }
Esempio n. 2
0
 private void axTOCControl1_OnMouseUp(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnMouseUpEvent e)
 {
     if (e.button == 1)
     {
         esriTOCControlItem item  = esriTOCControlItem.esriTOCControlItemNone;
         IBasicMap          map   = null;
         ILayer             layer = null;
         object             other = null;
         object             index = null;
         mTOCControl.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);
         IMap pMap = axMapControl1.ActiveView.FocusMap;
         if (item == esriTOCControlItem.esriTOCControlItemLayer || layer != null)
         {
             //预移动图层和鼠标当前位置图层不一致时
             if (pMoveLayer != layer)
             {
                 ILayer pTempLayer;
                 for (int i = 0; i < pMap.LayerCount; i++)
                 {
                     pTempLayer = pMap.get_Layer(i);
                     //获取鼠标当前位置图层的索引值
                     if (pTempLayer == layer)
                     {
                         toIndex = i;
                     }
                 }
                 pMap.MoveLayer(pMoveLayer, toIndex);
                 axMapControl1.ActiveView.Refresh();
                 mTOCControl.Update();
             }
         }
     }
 }