Oza*_*_AB 32 c# backgroundworker
我是这个背景工作者的新手
我已经阅读了一些关于如何创建一个
这就是它产生的文章
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
Bitmap imgbox = new Bitmap(pictureBox.Image);
int imgHeight = imgbox.Height;
int imgWidth = imgbox.Width;
int counter = 1;
MinMaxWidth = imgWidth - 50;
MaxWidth = imgWidth;
try
{
Color c;
//Color c2;
for (int i = 0; i < imgbox.Width; i++)
{
for (int j = 0; j < imgbox.Height; j++)
{
c = imgbox.GetPixel(i, j);
string cn = c.Name;
counter++;
backgroundWorker1.ReportProgress(counter);
}
}
MessageBox.Show("SUCESSFULLY DONE");
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
MyProgress.Value = e.ProgressPercentage;
}
Run Code Online (Sandbox Code Playgroud)
但是当我开始DoWork活动时.这个错误出现了
这
BackgroundWorker表明它不报告进度.
修改WorkerReportsProgess以声明它确实报告进度.
我按照教程说的
那样会出现什么问题?,有什么东西让我忘了吗?