Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Gradient Progress Bar [VB/C#]

Not sure if something like this has ever been released before, but decided to released a Gradient Based Progress Bar, which has some Text on it.

Screenshot:
[Image: b02f87754d.png]

Public Properties that are Handled:
Maximum, Minimum, Value, ShowText, Text, Font, StartColor (Gradient), FinishColor (Second Color, Gradient), foreColor, BackColor

Public Subs/Events:
Increment(), Increment(Int32)

Source:
C#: http://pastebin.com/duxu5BGN
VB: http://pastebin.com/1jQm2u0L

Example Project [No Executables][C#/VB]:
Download: Mega

Credits:
Helper.ValueToPercentage -> Taken from one of LordPankake's Themes
Helper.CenterString -> Taken from AeroRev9's Genesis Theme, and Modified
Layout of the ProgressBar Control -> AeroRev9's Genesis Theme (Again :P)

Notes:
Use a hack-y fix to prevent an OutOfMemory exception (Which should be an InvalidArgumentException), due to a 0-0 width LinearGradientBrush.
Functionality > Style in this release :P
Inherits from Control
Helper.MultiDispose in C# doesn't check to see if the LinearGradientBrush is null
Helper.CenterString in C# moves the text 1 pixel higher...should probs fix that.

Edit: Forgot to mention some fun things that can be done.

If you change the LinearGradientBrush, so that rather then using the Value of the Progress bar, it went 0-1 for width, and 0-Height for height, it would make a vertical gradient.

With enough persistance, i'm sure it's more then possible to make a Gradient on a 45 degree angle, which combines the current value and the height. Mix that with a 3 Color Gradient to give it a shine in the middle going across, and it could look quite good!
its been here but another one is not bad
about credit i think they also take it from some one so its not really from them
also the function not really needed u can u the code in OnPaint what most do
(Dec 31, 2014 03:09 AM)Only3 Wrote:  its been here but another one is not bad
about credit i think they also take it from some one so its not really from them
also the function not really needed u can u the code in OnPaint what most do

I credited the source of where i got it from. Everyone should do the same, so end result is the original coder of the function gets the credit for it.

The functions are in a Helper class, because i used that class (and stripped unused functions from it) when converting AeroRev9's Genesis Theme to C#. It also makes the code a hell of a lot learner.
Looks really neat if you ask me.

I wish you could make so the user could select which colour the progressbar should have.

Overall, it's good.
^^ 😊 StartColor As Color : FinishColor As Color
(Dec 31, 2014 03:40 AM)Marwix Wrote:  Looks really neat if you ask me.

I wish you could make so the user could select which colour the progressbar should have.

Overall, it's good.

Woops, forgot to put those in the public properties section of the post :P

As Only3 said, StartColor and FinishColor allows you to set the Gradient's colors, to anything you want (Color.FromArgb(Int, Int, Int)), The text and Border use the ForeColor Color, and the no-value portion of the progress bar uses the BackColor. Essentially, except for the shape of the control, the position of the text, and the thickness of the border, it's completely customizable from the Properties Panel in the Design Mode.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by going clearJan 16, 2021 12:16 PM 2 136 Jan 16, 2021 12:16 PM
Last Post: HFDone
[Python] by Freed0m36Nov 22, 2018 02:59 AM 7 204 Nov 22, 2018 02:59 AM
Last Post: PoP-Hacker
[Shell] by HackooMar 29, 2018 04:04 AM 5 290 Mar 29, 2018 04:04 AM
Last Post: Hackoo