Sono nuovo di questo BackgroundWorker cosa
ho letto alcuni articoli su come crearne uno
questo è ciò che ha prodotto"Questo BackgroundWorker afferma che non segnala i progressi." - Perché?
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;
}
ma quando ho iniziato l'evento DoWork. ha mostrato questo errore
Questo
BackgroundWorker
afferma che non segnala lo stato di avanzamento.
Modificare lo statoWorkerReportsProgess
per segnalare lo stato di avanzamento.
Ijust segui ciò che dice il tutorial
quale sarebbe il problema ?, c'è qualcosa che ho dimenticato?