Color Transition Effect in .NET Windows Forms (Progressbar or something else)


Yesterday I was fiddling with a progress bar, it was performing step in every single action to show current status.

Worker had several phases so I decided to change the color in every phase which is more eye candy and useful to the user. I implemented color changes but it was not enough cool and then I decided develop a small color transition effect for every phase changes. Here is the code how I accomplish the task;

I used 3 main functions;
StepCloser() : One step increase or decrease first number to target number. Allows me to make transition of R,G,B numbers easily.

TransColors() : Apply transition effect to progress bar. Apply StepCloser() to every R,G,B color in startingColor and endingColor. Trans color has a SyncLock because I want to see every color transition even there is another phase started.

ChangeColor() : Simply checks invoke and apply color to progressbar.

This process may can slow your application a bit, be careful! and disable lock if you want it faster.


Recent Blog Posts

See all of the blog posts