Exemplo n.º 1
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            try
            {
                m_pAV = m_pHookHelper.ActiveView;
                IViewManager pViewManager = (IViewManager)m_pAV;
                IEnumElement pEnumElement = (IEnumElement)pViewManager.ElementSelection;
                pEnumElement.Reset();
                IElement pElement = pEnumElement.Next();
                if (pElement == null)
                {
                    return;
                }
                int i = 0;
                while (pElement != null)
                {
                    i++;
                    pElement = pEnumElement.Next();
                    if (i > 1)
                    {
                        return;
                    }
                }

                pEnumElement.Reset();
                pElement = pEnumElement.Next();
                if (pElement is IMapSurroundFrame)
                {
                    IMapSurroundFrame pMapSFrame = (IMapSurroundFrame)pElement;
                    if (pMapSFrame.MapSurround is ILegend)
                    {
                        frmAddLegend vFrmLegend = new frmAddLegend(false);
                        vFrmLegend.SetMapSurroundFrame(pMapSFrame);
                        return;
                    }
                }
                frmElementProperty frm = new frmElementProperty(2);
                frm.StartEditElement(m_pAV, ref pElement);
                frm.ShowDialog();
                frm.Dispose();
            }
            catch { }
        }
Exemplo n.º 2
0
        public void OnClick(int EditMode)
        {
            m_pAV = m_pHookHelper.ActiveView;
            IViewManager pViewManager = (IViewManager)m_pAV;
            IEnumElement pEnumElement = (IEnumElement)pViewManager.ElementSelection;

            pEnumElement.Reset();
            IElement pElement = pEnumElement.Next();

            if (pElement == null)
            {
                return;
            }
            int i = 0;

            while (pElement != null)
            {
                i++;
                pElement = pEnumElement.Next();
                if (i > 1)
                {
                    return;
                }
            }

            pEnumElement.Reset();
            pElement = pEnumElement.Next();

            if (pElement is IMapSurroundFrame)
            {
                IMapSurroundFrame pMapSFrame = (IMapSurroundFrame)pElement;
                if (pMapSFrame.MapSurround is ILegend)
                {
                    frmAddLegend vFrmLegend = new frmAddLegend(false);
                    vFrmLegend.SetMapSurroundFrame(pMapSFrame);
                    return;
                }
            }

            IPageLayoutControl pPageLayoutControl = null;

            if (EditMode == 1)
            {
                if (m_pHookHelper.Hook is IToolbarControl)
                {
                    IToolbarControl pToolBarControl = m_pHookHelper.Hook as IToolbarControl;
                    if (pToolBarControl.Buddy is IPageLayoutControl)
                    {
                        pPageLayoutControl = pToolBarControl.Buddy as IPageLayoutControl;
                    }
                }
                else if (m_pHookHelper.Hook is IPageLayoutControl)
                {
                    pPageLayoutControl = m_pHookHelper.Hook as IPageLayoutControl;
                }
            }
            frmElementProperty frm = new frmElementProperty(EditMode);

            frm.set_PageLayoutControl = pPageLayoutControl;
            frm.StartEditElement(m_pAV, ref pElement);
            frm.ShowDialog();
            frm.Dispose();
        }