在应用程序关闭射击事件 [英] Firing event on application close

查看:104
本文介绍了在应用程序关闭射击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用网络套接字WinForms应用程序,我想关闭套接字,当应用程序被关闭,以便我怎么能触发事件时,在应用程序关闭?

I have a winforms application that uses a network socket and I want to close the socket when the application is closed so how can I fire an event when the application is closed?

推荐答案

我发现应用程序事件。

你可以触发应用程序关闭这样

I found the Application Event.
You can trigger an event on application close like this

System.Windows.Forms.Application.ApplicationExit +=new System.EventHandler(this.shutdownHandler);

这篇关于在应用程序关闭射击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆