Ejemplo n.º 1
0
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap          basicMap = null;
            ILayer             layer    = null;
            object             unk      = null;
            object             data     = null;

            this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);
            if (e.button == 1)
            {
                System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
                if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    //取得图例
                    ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
                    //创建符号选择器SymbolSelector实例
                    SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
                    if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
                    {
                        //局部更新主Map控件
                        this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        //设置新的符号
                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                        //更新主Map控件和图层控件
                        this.axMapControl1.ActiveView.Refresh();
                        this.axTOCControl1.Refresh();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
 {
     esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
     IBasicMap basicMap = null;
     ILayer layer = null;
     object unk = null;
     object data = null;
     this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);
     if (e.button == 1)
     {
         System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
         if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
         {
             //取得图例
             ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
             //创建符号选择器SymbolSelector实例
             SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
             if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
             {
                 //局部更新主Map控件
                 this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                 //设置新的符号
                 pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                 //更新主Map控件和图层控件
                 this.axMapControl1.ActiveView.Refresh();
                 this.axTOCControl1.Refresh();
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap          basicMap = null;
            ILayer             layer    = null;
            object             unk      = null;
            object             data     = null;

            this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);

            #region 调用ESRI自带的图层样式
            //if (e.button == 1)
            //{
            //    axTOCControl1.HitTest(e.x, e.y, ref item, ref pBasicMap, ref pLayer, ref other, ref index);
            //    System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
            //    if (item == esriTOCControlItem.esriTOCControlItemLegendClass)
            //    {
            //        ILegendClass pLC = new LegendClassClass();
            //        ILegendGroup pLG = new LegendGroupClass();
            //        if (other is ILegendGroup)
            //        {
            //            pLG = (ILegendGroup)other;
            //        }
            //        pLC = pLG.get_Class((int)index);
            //        ISymbol pSym = pLC.Symbol;
            //        ISymbolSelector pSS = new SymbolSelectorClass();
            //        bool bOK = false;
            //        pSS.AddSymbol(pSym);
            //        bOK = pSS.SelectSymbol(0);
            //        if (bOK)
            //        {
            //            pLC.Symbol = pSS.GetSymbolAt(0);
            //        }
            //        this.axMapControl1.ActiveView.Refresh();
            //        //this.axMapControl2.ActiveView.Refresh();
            //        this.axTOCControl1.Refresh();
            //    }
            //}
            #endregion

            if (e.button == 1)
            {
                System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
                if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    //取得图例
                    ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
                    //创建符号选择器SymbolSelector实例
                    SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
                    if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
                    {
                        //局部更新主Map控件
                        this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        //设置新的符号
                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                        //更新主Map控件和图层控件
                        this.axMapControl1.ActiveView.Refresh();
                        this.axTOCControl1.Refresh();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap basicMap = null;
            ILayer layer = null;
            object unk = null;
            object data = null;
            this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);

            #region ����ESRI�Դ���ͼ����ʽ
            //if (e.button == 1)
            //{
            //    axTOCControl1.HitTest(e.x, e.y, ref item, ref pBasicMap, ref pLayer, ref other, ref index);
            //    System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
            //    if (item == esriTOCControlItem.esriTOCControlItemLegendClass)
            //    {
            //        ILegendClass pLC = new LegendClassClass();
            //        ILegendGroup pLG = new LegendGroupClass();
            //        if (other is ILegendGroup)
            //        {
            //            pLG = (ILegendGroup)other;
            //        }
            //        pLC = pLG.get_Class((int)index);
            //        ISymbol pSym = pLC.Symbol;
            //        ISymbolSelector pSS = new SymbolSelectorClass();
            //        bool bOK = false;
            //        pSS.AddSymbol(pSym);
            //        bOK = pSS.SelectSymbol(0);
            //        if (bOK)
            //        {
            //            pLC.Symbol = pSS.GetSymbolAt(0);
            //        }
            //        this.axMapControl1.ActiveView.Refresh();
            //        //this.axMapControl2.ActiveView.Refresh();
            //        this.axTOCControl1.Refresh();
            //    }
            //}
            #endregion

            if (e.button == 1)
            {
                System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
                if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    //ȡ��ͼ��
                    ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
                    //��������ѡ����SymbolSelectorʵ��
                    SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
                    if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
                    {
                        //�ֲ�������Map�ؼ�
                        this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        //�����µķ���
                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                        //������Map�ؼ���ͼ��ؼ�
                        this.axMapControl1.ActiveView.Refresh();
                        this.axTOCControl1.Refresh();
                    }
                }
            }
        }