public void SwitchTo(FormView view) { if (view == null) { throw new Exception("Argument cannot be null"); } else if (!viewList.Contains(view)) { throw new Exception("Control doesn't contain the view specified"); } viewList.Remove(view); viewList.Insert(0, view); if (ActiveView != null) { ActiveView.ClearForm(BaseForm); } ActiveView = view; view.FillForm(BaseForm); view.OnSelect(new EventArgs()); foreach (MenuItem item in ViewMenu.MenuItems) { item.Checked = false; } var menuItem = FindMenuItem(view.Text); if (menuItem != null) { menuItem.Checked = true; } if (ToolBar != null) { ToolBar.SetViewTools(view.Tools); } BaseForm.Invalidate(); BaseForm.Activate(); }