请问: .net 是不是不支持 Suspend(), Resume()了? 为什么,上面的没有返应? 你说线程池,与我 new Thread() 方法开劈的线程,有何不同?
问题可能出在from2.ShowProgress方法,
我把 form2 贴出来, 麻凡 帮看看! public partial class Form2 : Form { public Form2() { InitializeComponent(); } private int value; public int Value { get { return value; } set { value = Value; } } private void Form2_Load(object sender, EventArgs e) { value = 50; } public void ShowProgress() {
.net 是不是不支持 Suspend(), Resume()了?
为什么,上面的没有返应?
你说线程池,与我 new Thread() 方法开劈的线程,有何不同?
麻凡 帮看看!
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private int value;
public int Value {
get { return value; }
set { value = Value; }
}
private void Form2_Load(object sender, EventArgs e)
{
value = 50;
}
public void ShowProgress()
{
progressBar1.Value = value;
}
private Timer tim;
private void btnInVal_Click(object sender, EventArgs e)
{
progressBar1.Value = 0;
if (tim == null)
{
tim = new Timer();
tim.Interval = 50;
tim.Tick += new EventHandler(timTick);
}
tim.Start();
}
private void timTick(object sender, EventArgs e)
{
if (progressBar1.Value < 100)
{
progressBar1.Value++;
}
else
{
progressBar1.Value = 0;
tim.Stop();
}
}
}