I created a custom ProgressBar by fallowing this example.
In my application, when a particualr event occurs, a page is printed and the print preview is displayed.
When the print preview appears, I add an exception whith my ProgressBar.
Code line :
ProgressBarRenderer.DrawHorizontalBar(g, rect);
Exception :
Visual styles are disabled by the user in the operating system.
I added a test to avoid the exception :
if (!ProgressBarRenderer.IsSupported)
return;
Now I don't have the exception, but instead the test failed and it always return. So the bar is not painted and never appears again.
What can I do to keep my ProgressBar always painted ?