Amigo añadi esto al DOWork:
quedando asi:
y si funciona!....
gracias por tu ayuda me ha servido de mucho
Código (csharp) [Seleccionar]
if (backgroundWorker1.CancellationPending == true)
{
e.Cancel = true;
return;
}
quedando asi:
Código (csharp) [Seleccionar]
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
while (true)
{
imgId = rnd.Next(minValue: 0, maxValue: 3);
switch (imgId)
{
case 0:
img = Traga_monedas_frutas.Properties.Resources.Manzana;
break;
case 1:
img = Traga_monedas_frutas.Properties.Resources.Pina;
break;
case 2:
img = Traga_monedas_frutas.Properties.Resources.Cereza;
break;
default:
img = Traga_monedas_frutas.Properties.Resources.Banana;
break;
}
if (backgroundWorker1.CancellationPending == true)
{
e.Cancel = true;
return;
}
Invoke(PictureBoxDelegate, new object[] { pictureBox1, img });
}
}
y si funciona!....
gracias por tu ayuda me ha servido de mucho
