クラス A には Form1 (System.Windows.Forms.Form のサブクラス) メンバーがあります。
class A {
Form1 form;
public A()
{
form = new Form1();
form.Show();
}
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
A a = new A();
Application.Run();
}
問題は、プログラムを終了する方法がわからないことです。Form.Closed
イベントを処理するとき、または A.Dispose() を呼び出すときに Application.Exit() を試しましたが、Windows タスク マネージャーにはまだプログラムのプロセスが表示されます。
このプログラムを終了するにはどうすればよいですか?