コード例 #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;

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

            if (e.button == 1)
            {
                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控件

                        axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);

                        //设置新的符号

                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;

                        //更新主Map控件和图层控件

                        this.axMapControl1.ActiveView.Refresh();

                        this.axTOCControl1.Refresh();
                    }
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Krystal001025/temp
        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;

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

            if (e.button == 1)
            {

                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控件

                        axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);

                        //设置新的符号

                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;

                        //更新主Map控件和图层控件

                        this.axMapControl1.ActiveView.Refresh();

                        this.axTOCControl1.Refresh();

                    }
                }
            }
        }