I have a window form having one PictureBox
. I have added .gif
file to it. This form is kind a progress bar so I am opening this in a separate thread then a main thread. Issue I am having is until all the threads are completed gif image
is not start animating
.
Please suggest. Below is my code:
private bool StartUploading()
{
objLoadingThread = new Thread(LoadProgressBar);
objLoadingThread.Start();
..
..
..
..
StopProgress = true;
}
// Progress bar
private void LoadProgressBar()
{
objAlertForm = new AlertForm();
objAlertForm.Show();
objAlertForm.Refresh();
while (!StopProgress)
{
for (int i = 0; i <= 100; i++)
{
objAlertForm.ProgressValue = i;
if (StopProgress)
{
break;
}
Thread.Sleep(100);
}
}
objAlertForm.Hide();
StopProgress = false;
objLoadingThread.Abort();
}