![]() |
|
[.NET] Gradient Progress Bar [VB/C#] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Gradient Progress Bar [VB/C#] (/showthread.php?tid=4611901) |
Gradient Progress Bar [VB/C#] - Nikey646 - Dec 31, 2014 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: ![]() 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! * - Only3 - Dec 31, 2014 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 * - Nikey646 - Dec 31, 2014 (Dec 31, 2014 03:09 AM)Only3 Wrote: its been here but another one is not bad 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. * - Marwix - Dec 31, 2014 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. * - Only3 - Dec 31, 2014 ^^ 😊 StartColor As Color : FinishColor As Color * - Nikey646 - Dec 31, 2014 (Dec 31, 2014 03:40 AM)Keiko Wrote: Looks really neat if you ask me. 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. |