Пример #1
0
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            IBasicMap          map  = null;
            esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;

            ATOCControl.HitTest(e.x, e.y, ref item, ref map, ref _layer, ref _other, ref _index);

            if (item == esriTOCControlItem.esriTOCControlItemLegendClass)
            {
                SetSymbol(sender, e);
            }
        }
Пример #2
0
        private void SetSymbol(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem toccItem  = esriTOCControlItem.esriTOCControlItemNone;
            ILayer             iLayer    = null;
            IBasicMap          iBasicMap = null;
            object             unk       = null;
            object             data      = null;

            if (e.button == 1)//鼠标左键按下
            {
                axTOCControl.HitTest(e.x, e.y, ref toccItem, ref iBasicMap, ref iLayer, ref unk, ref data);
                System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
                if (toccItem == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    ESRI.ArcGIS.Carto.ILegendClass pLC = new LegendClassClass();
                    ESRI.ArcGIS.Carto.ILegendGroup pLG = new LegendGroupClass();
                    if (unk is ILegendGroup)
                    {
                        pLG = (ILegendGroup)unk;
                    }
                    pLC = pLG.get_Class((int)data);
                    ISymbol pSym;
                    pSym = pLC.Symbol;
                    ESRI.ArcGIS.DisplayUI.ISymbolSelector pSS = new  ESRI.ArcGIS.DisplayUI.SymbolSelectorClass();
                    bool bOK = false;
                    pSS.AddSymbol(pSym);
                    bOK = pSS.SelectSymbol(0);
                    if (bOK)
                    {
                        pLC.Symbol = pSS.GetSymbolAt(0);
                    }
                    ATOCControl.ActiveView.Refresh();
                    ATOCControl.Update();
                    this.axTOCControl.Refresh();
                }
            }
        }
Пример #3
0
 public void Init(IMapControl4 mapControl)
 {
     _mapControl = mapControl;
     ATOCControl.SetBuddyControl(mapControl);
 }