我是 c#/.net 的初学者,所以请告诉我如何使用 BackgroundWorker 而不是 Application.DoEvent。
这是我的代码:
while (webBrowser1.ReadyState!= WebBrowserReadyState.Complete)
{
Application.DoEvents(); //how to use "BackgroundWorker" here
if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
listBox1.SelectedIndex = 0;
var num = listBox1.Items.Count;
string str = Convert.ToString(num);
label2.Text = str;
}
}