大家帮我改改代码,要实现的功能是这样的:打开程序自动阻止关机、重启动作,点击X关闭后缩小到任务栏,这个已经实现,但是还不能阻止关机,大家帮我改一下代码~~~
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace 示例
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.Visible)
            {
                e.Cancel = true;
            }
            else
            {
                e.Cancel = false;
            }            this.Visible = false;
        }        private void button1_Click(object sender, EventArgs e)//缩小到任务栏按钮
        {
            //Application.Exit();
            //Form fm = new Form();
            //fm.Dispose();
            this.Visible = false;
        }        private void 显示ToolStripMenuItem_Click(object sender, EventArgs e)//显示窗体
        {
            this.Visible = true;
        }        private void 完全退出ToolStripMenuItem_Click(object sender, EventArgs e)//退出菜单
        {
            this.Close();
        }
    }
}