Click here to Skip to main content
15,889,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ensure ApplyVisualStyles is enabled in your system. Place a ToolStripProgressBar on a toolstrip, run your application and minimize the form. Now change the theme of your computer to Windows Classic and restore the form. See the interior of the ToolStripProgrssBar becomes black. It doesn't even change if you refresh the form. How does the user know the status of the progress if it remains black always? Any approach to fugure it out? Regards.
Posted
Comments
Dave Kreskowiak 2-Aug-12 12:58pm    
What Style is the prograssbar using?? You might want to handle the SystemEvent DisplaySettingsChanged event and change the Style property of the progressbar to fix this. I have no idea if it would work as I haven't tried it myself.
priyamtheone 4-Aug-12 10:46am    
@Dave Kreskowiak- Checked both ManagerRenderMode and Professional styles. I tried repainting the ProgressBar in the SystemColorsChanged event but of no avail.

are you expecting users to often start a process, minimise a form, change the theme and then restore the form ?
 
Share this answer
 
Comments
priyamtheone 4-Aug-12 10:54am    
@Christian Graus- more or less often, there's always a possibility. Say, the user initiated a process that'll take a little time to be completed. The ProgressBar moves on accordingly. By this time, the user may minimize the form to do other works; during which she/he may change the theme and restore the form at a later time. After all we won't decide what the user will do.
Seems to be a bug. A workaround is to handle SystemEvents.UserPreferenceChanged for e.Category=VisualStyle and change the progressbar style to something and back again.

VB
Imports System
Imports Microsoft.Win32

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AddHandler SystemEvents.UserPreferenceChanged, AddressOf SystemEvents_UserPreferenceChanged
    End Sub

    Private Sub SystemEvents_UserPreferenceChanged(ByVal sender As Object, ByVal e As UserPreferenceChangedEventArgs)
        If e.Category = UserPreferenceCategory.VisualStyle Then
            Dim CurrentStyle As ProgressBarStyle = ToolStripProgressBar1.Style

            For Each Style As ProgressBarStyle In [Enum].GetValues(GetType(ProgressBarStyle))
                If Not Style.Equals(CurrentStyle) Then
                    ToolStripProgressBar1.Style = Style
                    Exit For
                End If
            Next

            ToolStripProgressBar1.Style = CurrentStyle
        End If
    End Sub
End Class
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900