winform 无窗体保持消息循环

static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var timer1 = new System.Windows.Forms.Timer() { Interval = 1000 };
            timer1.Tick += new EventHandler(timer1_Tick);
            timer1.Start();
            Application.Run();
        }

        static void timer1_Tick(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }
    }

 

posted on 2025-02-04 11:44  空明流光  阅读(16)  评论(0)    收藏  举报

导航