예제 #1
0
        public void JumpToPage(int PageNumber)
        {
            if ((PageNumber >= 0) && (PageNumber < Controls.Count))
            {
                foreach(Control control in Controls)
                {
                    control.Visible = false;
                }

                CurrentPage = (CardPanelPage)Controls[PageNumber];
                CurrentPage.Visible = true;
            }
        }
예제 #2
0
        public void PreviousPage()
        {
            int Index = Controls.IndexOf(CurrentPage);

            if ((Controls.Count > 1) && (Index != 0))
            {
                CurrentPage.Visible = false;
                CurrentPage = (CardPanelPage)Controls[Index - 1];
                CurrentPage.Visible = true;
            }
        }
예제 #3
0
        public void NextPage()
        {
            int Index = Controls.IndexOf(CurrentPage);

            if ((Controls.Count > 1) && (Index != (Controls.Count - 1)))
            {
                CurrentPage.Visible = false;
                CurrentPage = (CardPanelPage)Controls[Index + 1];
                CurrentPage.Visible = true;
            }
        }
예제 #4
0
 private void CardPanelDesigner_PageChanged(object sender, EventArgs e)
 {
     Page = ((CardPanel)Control).SelectedItem;
 }
예제 #5
0
        private void CardPanel_ControlAdded(object sender, ControlEventArgs e)
        {
            if (e.Control is CardPanelPage)
            {
                e.Control.Location = new Point(0, 0);
                e.Control.Size = ClientSize;
                e.Control.Dock = DockStyle.Fill;

                if (SelectedItem == null)
                {
                    SelectedItem = (CardPanelPage)e.Control;
                }
                else
                {
                    e.Control.Visible = false;
                }
            }
            else
            {
                Controls.Remove(e.Control);
            }
        }
예제 #6
0
        public void RemovePage(int PageNumber)
        {
            if ((PageNumber >= 0) && (PageNumber < Controls.Count))
            {
                int Index = Controls.IndexOf(CurrentPage);
                Controls.RemoveAt(PageNumber);
                CurrentPage = null;

                if (Controls.Count > 0)
                {
                    if (Index == 0)
                    {
                        CurrentPage = (CardPanelPage)Controls[0];
                    }
                    else if (Index == (Controls.Count - 1))
                    {
                        CurrentPage = (CardPanelPage)Controls[Controls.Count - 1];
                    }
                    else
                    {
                        CurrentPage = (CardPanelPage)Controls[PageNumber - 1];
                    }

                    CurrentPage.Visible = true;
                }

                if (CurrentPage == null)
                {
                    CurrentPage = new CardPanelPage();
                    CurrentPage.Name = "CardPanelPage1";
                    Controls.Add(CurrentPage);
                    CurrentPage.Visible = true;
                }
            }
        }