2
这是我的,为什么我的计时器不停止? 我不知道我在做什么错。 我对C#相当陌生,我试图让它成为我的启动画面隐藏(form1)和我的程序启动(samptool),但是我的程序启动但启动屏幕保持,定时器重置而不是停止。应用程序每6.5秒会在新窗口中打开。C#计时器不停止?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Timers;
namespace SplashScreen.cs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
timer1.Interval = 250;
timer2.Interval = 6500;
timer1.Start();
timer2.Start();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
this.progressBar1.Increment(5);
}
private void timer2_Tick(object sender, EventArgs e)
{
SampTool w = new SampTool();
Form1 m = new Form1();
timer1.Enabled = false;
timer1.Stop();
timer2.Enabled = false;
timer2.Stop();
m.Hide();
w.Show();
}
}
}