ProgressBar style in WinForm

UriF 1 Reputation point
2021-06-03T10:21:46.273+00:00

I tried to use ProgressBar in VS 2015 (VB.NET & C#) Community. It works OK except Style. Doesn't matter if I use "Continuous" or "Blocks" style I get "Continuous" style. I also tried in VS 2017 Community and I got the same behavior. It is strange. I downloaded one sample C# project and I am able to select between "Continuous"and "Blocks" styles. I use Windows 10 x64 20H2. I understand if "Blocks" would be disabled but I was able to run a project where everything works OK.

You understand that I use absolutely simple code. I can use "Continuous" style but I like I prefer "Blocks" style.

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,883 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 53,406 Reputation points
    2021-06-03T15:07:26.297+00:00

    ProgressBar is backed by the OS, like most Winforms controls. When visual styles are enabled, the default, then it uses the OS theming and blocks is not supported as shown here. To disable this you'd need to go to your Program.Main function and comment out the EnableVisualStyles line. However that reverts your app to the "Win95" look which is probably not what you want.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.