private void toolStripButton_Click(object sender, EventArgs e) { StackBarButton senderButton = (StackBarButton)((ToolStripButton)sender).Tag; if (senderButton == this.selectedButton) { // Just need to re-set the checked status senderButton.Button.Checked = true; } else { foreach (StackBarButton button in buttonList) { button.Button.Checked = false; } senderButton.Button.Checked = true; selectedButton = senderButton; titleLabel.Text = senderButton.Button.Text; if (senderButton.NavigationPaneControl != null) { navigationPanel.SuspendLayout(); navigationPanel.Controls.Clear(); navigationPanel.Controls.Add(senderButton.NavigationPaneControl); navigationPanel.ResumeLayout(); } if (ButtonClicked != null) { ButtonClicked.Invoke(senderButton, EventArgs.Empty); } } }
/// <summary> /// Show a Button /// </summary> /// <param name="buttonName">Name of button to Show</param> public void ShowButton(string buttonName) { StackBarButton button = GetButtonByName(buttonName); button.Visible = true; ResizeButtonStack(ButtonStackHeight); menu_ShowFewerButtons.Enabled = true; }
/// <summary> /// Hide a Button /// </summary> /// <param name="buttonName">Name of button to Hide</param> public void HideButton(string buttonName) { StackBarButton button = GetButtonByName(buttonName); button.Visible = false; ResizeButtonStack(ButtonStackHeight); return; }