private void CreateNavigator(NavigatorType type) { INavigator navigator = NavigatorFactory.CreateNavigator(this, type); int currentNavSize = 0; int selectedIndex = -1; if (navigator is Control == false) { throw new ArgumentException("Notebook navigators must inherit from Control."); } if (mNavigator != null) { selectedIndex = SelectedIndex; switch (Navigator.Location) { case NavigatorLocation.Left: case NavigatorLocation.Top: currentNavSize = mSplitterLocation; break; case NavigatorLocation.Bottom: currentNavSize = ClientSize.Height - mSplitterLocation; break; case NavigatorLocation.Right: currentNavSize = ClientSize.Width - mSplitterLocation; break; } } mNavType = type; mNavProperties = navigator.CreateProperties(); mNavigator = (Control)navigator; // remove any existing navigator before adding the new one NoteControls.RemoveNavigator(); NoteControls.Add(mNavigator); NavigatorInterface.RefreshAllPages(); SelectedIndex = selectedIndex; RedoLayout(); DisplayCorrectPage(); }