使用C#中的Windows窗体应用程序写一个无限弹窗
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace UnlimitWind
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Form1());
while (true)
{
Form1 form1 = new Form1();
form1.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace UnlimitWind
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Form1());
while (true)
{
Form1 form1 = new Form1();
form1.Show();
}
}
}
}
注意一定要把Application.Run(new Form1());这行代码删除或注释掉 原理:用一个while(true)无限循环来创建窗体对象,对象名.Show()方法不断地打开窗体