private void TabControl_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl.TabCount != 0) { StatusBarMessages.SetStatusBarMessageShowing(tabControl.SelectedTab.Text); } else { StatusBarMessages.SetStatusBarMessageShowing(string.Empty); } }
/// <summary> /// Occurs when a control is successfully added to the TabControl /// </summary> /// <param name="sender">The control that initiated the event.</param> /// <param name="e">ControlEvent arguments.</param> private void TabControl_ControlAdded(object sender, ControlEventArgs e) { if (tabControl.SelectedTab != null) { StatusBarMessages.SetStatusBarMessageShowing(tabControl.SelectedTab.Text); } if (e.Control is TabPage tabPage) { foreach (var c in tabPage.Name) { if (!char.IsDigit(c)) { return; } } menuItemFile_Close.Enabled = true; menuItemFile_CloseAll.Enabled = true; menuItemFile_Print.Enabled = true; RecentlyOpenedDocs.AddNewNode(int.Parse(tabPage.Name), tabPage.Text); } }