Exemple #1
0
        /// <summary>
        /// 初始化图层树事件
        /// </summary>
        private void initLegend()
        {
            Legend.LayerMouseUp     += legend1_LayerMouseUp;
            Legend.LayerDoubleClick += legend1_LayerDoubleClick;
            Legend.Map = Map.GetOcx() as Map;
            Legend.AssignOrphanLayersToNewGroup("图层数据");
            Legend.LayerSelected += (handle) =>
            {
                RefreshUI();
            };
            Legend.LayerCheckboxClicked += Legend_LayerCheckboxClicked;
            Legend.GroupCheckboxClicked += Legend_GroupCheckboxClicked;
            //订阅该事件是为了跟踪每次加入的图层的图层句柄
            Legend.LayerAdded += handle => { curLayerHandle = Legend.Layers[handle].Handle; curLegendLayerHandle = handle; };
            Legend.GroupAdded += handle => curLegendGroupHandle = handle;
            Legend.LayerAdded += handle =>
            {
                if (axMap1.NumLayers > 0)
                {
                    resetAllToolStripBtn(s => s.Enabled = true);
                    recover_btn.Enabled   = true;
                    removeAll_btn.Enabled = true;
                }
            };
            Legend.LayerLabelClicked += handle =>
            {
                MessageBox.Show("labelClick");
            };

            Legend.MouseDown += (s, e) =>
            {
                System.Drawing.Point pnt = new System.Drawing.Point(e.X, e.Y);
                curLayer = Legend.FindClickedLayer(pnt, ref clickedElement);
            };
        }
Exemple #2
0
 private void InitLegend()
 {
     Legend.Map = Map.GetOcx() as Map;
     Legend.AssignOrphanLayersToNewGroup(ProjectBase.DEFAULT_GROUP_NAME);
     Legend.LayerSelected += (handle) =>
     {
         RefreshUI();
     };
 }