zoukankan      html  css  js  c++  java
  • 退出winform时弹出确认按钮

    代码
     /// <summary>
            
    /// 窗体关闭事件的处理程序
            
    /// </summary>
            
    /// <param name="sender"></param>
            
    /// <param name="e"></param>
            private void Form1_FormClosing(object sender, FormClosingEventArgs e)
            {
                
    if (MessageBox.Show("确实要退出服务程序吗?""退出程序", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    
    if ((MainTCPListenerThread != null&& MainTCPListenerThread.IsAlive)
                    {
                        StopTCPServerFun();
                        MainTCPListenerThread.Abort();
                    }
                    Environment.Exit(
    0);
                }
                
    else
                {
                    e.Cancel
    =true;
                }
            }


    ////////////////////////////////
    ////////Sixi. Let it be.../////
    //////////////////////////////

  • 相关阅读:
    前端-JavaScript
    前端-HTML
    Python源程序(.py)转换为可执行文件(.exe)
    进程
    算法之动态规划问题
    算法之斐波那契数列
    贪心算法找零问题
    算法之迷宫问题
    数据结构相关知识
    常用排序算法
  • 原文地址:https://www.cnblogs.com/sixiweb/p/1717082.html
Copyright © 2011-2022 走看看