[转][C#]关闭窗体

防止用户手动关闭窗体:

if ((e.CloseReason & System.Windows.Forms.CloseReason.UserClosing) == System.Windows.Forms.CloseReason.UserClosing)

    e.Cancel = true;

原文地址:https://www.cnblogs.com/z5337/p/13458334.html