Exemple #1
0
        /// <summary>
        /// 地图控件与TOC控件的关联操作
        /// </summary>
        /// <param name="tocCtrl">TOC控件</param>
        /// <param name="mapCtrl">地图控件</param>
        /// <param name="attributeCtrl">显示属性表的控件/窗体</param>
        /// <param name="switchView">将当前标签页设为地图页面</param>
        public MapCtrlToc(AxTOCControl tocCtrl, AxMapControl mapCtrl, IAttributeCtrl attributeCtrl, Action <EViewActionType[]> switchView = null)
        {
            MapControl = mapCtrl;
            TocControl = tocCtrl;
            TocControl.SetBuddyControl(MapControl);
            TocControl.OnMouseDown += tocCtrl_OnMouseDown;
            SwitchView              = switchView;
            AttributeCtrl           = attributeCtrl;
            _attributeCtrlType      = AttributeCtrl.GetType();

            Layer2FieldsMenuItems = new Dictionary <string, ToolStripMenuItem[]>();
            InintMenuStrip();
        }
Exemple #2
0
 protected virtual void 打开属性表ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (SelectedLayer is ITable table)
     {
         if (AttributeCtrl == null || AttributeCtrl.IsDisposed)
         {
             AttributeCtrl = (IAttributeCtrl)Activator.CreateInstance(_attributeCtrlType);
         }
         AttributeCtrl.FeatureLocation -= _attributeForm_FeatureLocation;
         AttributeCtrl.FeatureLocation += _attributeForm_FeatureLocation;
         AttributeCtrl.Show(MapControl);
         AttributeCtrl.Activate();//之前已打开,则给予焦点,置顶。
         AttributeCtrl.LoadAttribute((IFeatureLayer)SelectedLayer, ((IFeatureLayerDefinition)SelectedLayer).DefinitionExpression);
     }
 }