Пример #1
0
        private void RemovePage(object sender, EventArgs ea)
        {
            IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost));

            if (dh != null)
            {
                DesignerTransaction dt = dh.CreateTransaction("Removed page");

                MultiPanelPage page = m_mpanel.SelectedPage;
                if (page != null)
                {
                    MultiPanelPage ytp = m_mpanel.SelectedPage;
                    m_mpanel.Controls.Remove(ytp);
                    dh.DestroyComponent(ytp);

                    if (m_mpanel.Controls.Count > 0)
                    {
                        m_mpanel.SelectedPage = (MultiPanelPage)m_mpanel.Controls[m_mpanel.Controls.Count - 1];
                    }
                    else
                    {
                        m_mpanel.SelectedPage = null;
                    }

                    RaiseComponentChanging(TypeDescriptor.GetProperties(Control)["SelectedPage"]);
                    RaiseComponentChanged(TypeDescriptor.GetProperties(Control)["SelectedPage"], ytp, m_mpanel.SelectedPage);
                }

                dt.Commit();
            }
        }
Пример #2
0
 public void SelectPrevPage()
 {
     if (SelectedPageN - 1 >= 0)
     {
         SelectedPageN--;
         SelectedPage = (MultiPanelPage)Controls[SelectedPageN];
     }
 }
Пример #3
0
 public void SelectNextPage()
 {
     if (SelectedPageN + 1 < Controls.Count)
     {
         SelectedPageN++;
         SelectedPage = (MultiPanelPage)Controls[SelectedPageN];
     }
 }
Пример #4
0
 public override void Initialize(IComponent component)
 {
     m_page = component as MultiPanelPage;
     if (m_page == null)
     {
         DisplayError(new Exception("You attempted to use a MultiPanelPageDesigner with a class that does not inherit from MultiPanelPage."));
     }
     base.Initialize(component);
 }