【发布时间】:2017-10-09 03:02:31
【问题描述】:
我正在用 C# 编写 Winforms。我想设置我的程序,以便如果关闭表单,程序将终止或停止。我已经知道如何选择首先打开的表单了。
这是我的 program.cs 中的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace MainMenu
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Login());
}
}
}
我想设置我的 login.cs 表单,以便如果该表单关闭,程序将终止。这可能吗?
`
【问题讨论】:
标签: c# .net winforms terminate