大家来看一看这个神奇的问题(绝对,绝对神奇;连if else 都几乎被颠覆了),我实在是木有办法了(关于线程安全的)
public void SetProcessInfo(int value)
{
if (progressBar1.InvokeRequired)
{
Action<int> setProcessDelegate = new Action<int>(SetProcessInfo);
progressBar1.Invoke(setProcessDelegate, value);
}
else
{//此处有断点1,条件(!progressBar1.InvokeRequired)
if (value > progressBar1.Maximum)
value = progressBar1.Maximum;
if (value < progressBar1.Minimum)
value = progressBar1.Minimum;
progressBar1.Value = value;//此处有断点2,条件(progressBar1.InvokeRequired)
}
}