void TabControl_OnTabChanged(object NewTabData) { SendMessage(Handle, WM_SETREDRAW, 0, 0); SuspendLayout(); if (CurrentWorkspace != null) { CurrentWorkspace.Deactivate(); CurrentWorkspace.Hide(); } if (NewTabData == null) { CurrentWorkspace = null; Settings.LastProjectFileName = null; DefaultControl.Show(); } else { CurrentWorkspace = (WorkspaceControl)NewTabData; Settings.LastProjectFileName = CurrentWorkspace.SelectedFileName; DefaultControl.Hide(); } Settings.Save(); if (CurrentWorkspace != null) { CurrentWorkspace.Activate(); CurrentWorkspace.Show(); } ResumeLayout(); SendMessage(Handle, WM_SETREDRAW, 1, 0); Refresh(); }