예제 #1
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            if (m_pHookHelper.PageLayout == null)
            {
                return;
            }

            try
            {
                IActiveView  pView = (IActiveView)m_pHookHelper.PageLayout;
                frmAddLegend frm   = new frmAddLegend(true);

                IMapSurroundFrame pLegendFrame = frm.GetMapLegend(pView);
                if (pLegendFrame == null)
                {
                    return;
                }
                frm.Dispose();

                pView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ìí¼ÓͼÀýʧ°Ü£º" + ex.Message, "Ìáʾ");
            }
        }
예제 #2
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 { }
        }
예제 #3
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();
        }