protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); e.Cancel = true; this.Hide(); }
加上这段代码,可以阻止窗口关闭,并且隐藏起来。