/// <summary> /// Occurs when one of the page's button is being clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPageButtonClicked(object sender, EventArgs e) { LuaEditPageButton button = sender as LuaEditPageButton; if (button != null && !button.Checked) { foreach (Control ctrl in pageButtonsPanel.Controls) { LuaEditPageButton pageButton = ctrl as LuaEditPageButton; if (pageButton != null && pageButton.Checked) { pageButton.Checked = false; break; } } pageContentPanel.Controls.Clear(); pageContentPanel.Controls.Add(button.Page.PageContent.Content); pageContentPanel.Controls[0].Left = 1; pageContentPanel.Controls[0].Top = 1; pageContentPanel.InvalidationLines.Clear(); pageContentPanel.AddInvalidationLine(button.PointToScreen(new Point(button.Right - 2, 1)), button.PointToScreen(new Point(button.Right - 2, button.Height - 2))); _currentPage = button.Page; button.Checked = true; } }
public LuaEditPageButton(LuaEditPageControlPage page) { InitializeComponent(); (pictureBox1.Image as Bitmap).MakeTransparent(Color.Fuchsia); _buttonImage = pictureBox1.Image as Bitmap; pictureBox1.Image = null; _page = page; base.Click += OnControlClicked; pictureBox1.Click += OnControlClicked; lblText.Click += OnControlClicked; }
/// <summary> /// Add a page to the page control /// </summary> /// <param name="pageContent">The page's content</param> /// <returns>The create LuaEditPage</returns> public LuaEditPageControlPage AddPage(ILuaEditPageControlPageContent pageContent) { LuaEditPageControlPage page = null; if (FindPageByTitle(pageContent.Title) == null) { page = new LuaEditPageControlPage(pageContent); _pages.Add(page); page.Parent = this; LuaEditPageButton button = new LuaEditPageButton(page); button.Text = pageContent.Title; button.Click += OnPageButtonClicked; pageButtonsPanel.Controls.Add(button); ComputePageButtonsPanel(); if (_currentPage == null) { OnPageButtonClicked(button, new EventArgs()); } } return(page); }
public LuaEditPageIndexChangedEventArgs(LuaEditPageControlPage page, int oldIndex, int newIndex) { _page = page; _oldIndex = oldIndex; _newIndex = newIndex; }