//该函数的作用是当IWorkbenchWindow被关闭时关闭该窗体那的视图 void CloseWindowEvent(object sender, EventArgs e) { IViewContent content = sender as IViewContent; if (content != null) { CloseView(content); OnActiveViewContentChanged(this, null); if (workbench.ViewContentCollection.Count == 0) { tabControl.Visible = false; DefaultStatusBarService defaultStatusBarService = (DefaultStatusBarService)ServiceManager.Services.GetService(typeof(DefaultStatusBarService)); defaultStatusBarService.SetCaretPosition(0, 0, 0); } } }