Have you tried using any code to handle the handle
SystemEvents.UserPreferenceChanged event for e.Category=VisualStyle.
(and possibly change the progressbar.Style)
Some links:
Handling System Events in VB.Net
There is also some "Private Sub UserPreferenceChangedHandler" code on
this StackOverFlow page.
Another option to try..
One of the
ToolStripProgressBar methods is OnPaint, which
raises the Paint event (inherited from
ToolStripControlHost).
MSDN has some
ToolStripItem.OnPaint method overrides code.
Another way (which is little bit awkward) would be to redirect the ToolStripProgressBar increment calls
which from code at the bottom of
this page might look like:
Code:
Private Sub incrementBar(ByVal pb As ToolStripProgressBar)
pb.Increment(1)
pb.ProgressBar.Refresh()
Dim g As Graphics = pb.ProgressBar.CreateGraphics
'draw custom custom graphics here..
br.Dispose()
g.Dispose()
End Sub
I believe this is based on
VB.Net code to allow the percentage text of completion to be displayed on a .Net progress bar control
(which in turn is based on a
C#.Net CodeProject "Extended ProgressBar" code, which has a longer explanation of the methodology designed toward creating a custom user control).
Lastly, have you had a chance to peruse the MSDN article:
"
Rendering Controls with Visual Styles"?
The interesting (possibly relevant) part:
Quote:
Other classes can only draw the related control when visual styles are available,
and their members will throw an exception if visual styles are disabled. These classes include:
ProgressBarRenderer
|
If you click on the ProgressBarRenderer link above, that page contains the following info:
Quote:
If visual styles are enabled in the operating system and visual styles are applied to the client area of application windows,
the methods of this class will draw the progress bar with the current visual style.
Otherwise, the methods and properties of this class will throw an InvalidOperationException.
To determine whether the members of this class can be used,
you can check the value of the IsSupported property.
|
..which bring up the question; Are you using any structured exception handling to test for visual styles?