Winform 计时器未触发[已关闭]

问题描述 投票:0回答:1

我正在尝试运行此 WinForm,但计时器操作未触发。

[STAThread]
static void Main()
{
    Application.Run(SplashPage.splash);
}

这是不触发计时器的表单

private void InitializeComponent()
{
    this.components = new System.ComponentModel.Container();
    System.Windows.Forms.Timer activeAppCheckTimer;
    System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashPage));
    this.pictureBox1 = new System.Windows.Forms.PictureBox();
    this.backupTime = new System.Windows.Forms.Timer(this.components);
    this.locationTimer = new System.Windows.Forms.Timer(this.components);
 
    activeAppCheckTimer = new System.Windows.Forms.Timer(this.components);
    ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
    this.SuspendLayout();
    
    activeAppCheckTimer.Enabled = true;
    activeAppCheckTimer.Interval = 1000;
    activeAppCheckTimer.Tick += new System.EventHandler(this.activeCheck);
  
   
    this.TopMost = true;
    this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
    this.Closed += new System.EventHandler(this.Form1_Closed);
    this.Load += new System.EventHandler(this.Form1_Load);
    ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
    this.ResumeLayout(false);

}

但活动应用程序未触发。

事件处理程序:

private void activeCheck(object sender, System.EventArgs e)
{
    try catch (Exception ex) {
        MessageBox.Show(ex.Message + ":" + ex.StackTrace);
    }
}

这是完整的代码 要点代码

c# .net winforms timer
1个回答
0
投票

activeAppCheckTimer.Start()
来电未接

© www.soinside.com 2019 - 2024. All rights reserved.