本文整理汇总了C#中System.Windows.Forms.Application.ThreadExit事件的典型用法代码示例。如果您正苦于以下问题:C# Application.ThreadExit事件的具体用法?C# Application.ThreadExit怎么用?C# Application.ThreadExit使用的例子?那么恭喜您, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在类System.Windows.Forms.Application
的用法示例。
在下文中一共展示了Application.ThreadExit事件的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application_ThreadExit
private void Application_ThreadExit(Object sender, EventArgs e) {
MessageBox.Show("You are in the Application.ThreadExit event.");
}
示例2: HelloWorldForm
//引入命名空间
using System;
using System.Threading;
using System.Reflection;
using System.Windows.Forms;
public class HelloWorldForm : Form {
public HelloWorldForm() {
}
public static void OnApplicationExit(object sender, EventArgs e) {
try {
Console.WriteLine("shutting down.");
} catch (NotSupportedException) {
}
}
public static void OnIdle(object sender, EventArgs e) {
Console.WriteLine("idle.");
}
public static void OnThreadException(object sender, ThreadExceptionEventArgs e) {
Console.WriteLine("caught!");
}
public static void OnThreadExit(object sender, EventArgs e) {
Console.WriteLine("thread is shutting down.");
}
public static void Main() {
HelloWorldForm FormObject = new HelloWorldForm();
Application.ApplicationExit += new EventHandler(OnApplicationExit);
Application.Idle += new EventHandler(OnIdle);
Application.ThreadException += new ThreadExceptionEventHandler(OnThreadException);
Application.ThreadExit += new EventHandler(OnThreadExit);
Application.Run(FormObject);
}
}