├── RCProgressBarExamples ├── .gitignore ├── App.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Program.cs ├── Form1.cs ├── RCProgressBarExamples.csproj ├── Form1.resx └── Form1.Designer.cs ├── RoundCorneredProgressBar ├── .gitignore ├── RoundCorneredProgressBar.nuspec ├── Properties │ └── AssemblyInfo.cs ├── RoundCorneredProgressBar.csproj └── RoundCorneredProgressBar.cs ├── animation.gif ├── .gitignore ├── CONTRIBUTING.MD ├── License.md ├── README.md └── RoundCorneredProgressBar.sln /RCProgressBarExamples/.gitignore: -------------------------------------------------------------------------------- 1 | obj/ 2 | bin/ -------------------------------------------------------------------------------- /RoundCorneredProgressBar/.gitignore: -------------------------------------------------------------------------------- 1 | obj/ 2 | bin/ 3 | nuget.exe 4 | *.nupkg -------------------------------------------------------------------------------- /animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Open-SL/RCProgressBar/HEAD/animation.gif -------------------------------------------------------------------------------- /RCProgressBarExamples/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #ignore thumbnails created by windows 2 | Thumbs.db 3 | #Ignore files build by Visual Studio 4 | *.obj 5 | *.exe 6 | *.pdb 7 | *.user 8 | *.aps 9 | *.pch 10 | *.vspscc 11 | *_i.c 12 | *_p.c 13 | *.ncb 14 | *.suo 15 | *.tlb 16 | *.tlh 17 | *.bak 18 | *.cache 19 | *.ilk 20 | *.log 21 | [Bb]in 22 | [Dd]ebug*/ 23 | *.lib 24 | *.sbr 25 | obj/ 26 | [Rr]elease*/ 27 | _ReSharper*/ 28 | [Tt]est[Rr]esult* -------------------------------------------------------------------------------- /CONTRIBUTING.MD: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | Bug reports and pull requests are welcome on GitHub at https://github.com/Open-SL/RCProgressBar . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. 4 | 5 | ## License 6 | 7 | The boilerplate is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 8 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace RCProgressBarExamples 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RoundCorneredProgressBar/RoundCorneredProgressBar.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RoundCornerProgressBar 5 | $version$ 6 | $title$ 7 | Nadun Indunil 8 | Nadun Indunil 9 | false 10 | RoundCornered ProgressBar using PictureBox 11 | Initial release. 12 | Copyright 2016 13 | progressBar Round corner edges WinForm Form Progress 14 | 15 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace RCProgressBarExamples 12 | { 13 | public partial class Form1 : Form 14 | { 15 | public Form1() 16 | { 17 | InitializeComponent(); 18 | 19 | 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | roundCorneredProgressBar1.Animate(); 25 | roundCorneredProgressBar2.Animate(); 26 | roundCorneredProgressBar3.Animate(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Open-SL 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rounded Corner ProgressBar for WinForm 2 | Rounded Corner ProgressBar is a custom control inherited from 'PictureBox' for WinForm with animation. 3 | Main purpose of the component is to have a smooth animation and proper curved edges in progressbar. 4 | 5 | ### TO INSTALL THE LIBRARY 6 | This library is available as a NuGet package at [nuget.org](https://www.nuget.org/packages/RoundCornerProgressBar/). 7 | 8 | ### INSTRUCTIONS 9 | Use toolbox to add the control to your forms. 10 | 11 | Check 'RCProgressBarExamples' project for more examples. 12 | 13 | ![animation](/animation.gif?raw=true "animation") 14 | 15 | ### CONTROL PROPERTIES 16 | ##### Properties 17 | 18 | * `RoundCorneredProgressBar.Value`: Value to be shown in progress bar. 19 | * `RoundCorneredProgressBar.ProgressFontColor`: Font Color of the progress shown. 20 | * `RoundCorneredProgressBar.ProgressFont`: Set the font style of the progress percentage. 21 | * `RoundCorneredProgressBar.ProgressBackColor`: set the backcolor of the progressbar. 22 | * `RoundCorneredProgressBar.ProgressBarColor`: set the bar color of the progressbar. 23 | 24 | ##### Methods 25 | 26 | * `RoundCorneredProgressBar.Animate`: Starts the smooth animatioin of filling progress. 27 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RCProgressBarExamples.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RCProgressBarExamples")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RCProgressBarExamples")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7264cc17-7530-4a21-b23a-ca2a8b87df94")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RoundCorneredProgressBar/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RoundCorneredProgressBar")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Nadun Indunil")] 12 | [assembly: AssemblyProduct("RoundCorneredProgressBar")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0843d594-7243-4286-952f-650d2e623e86")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RoundCorneredProgressBar.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoundCorneredProgressBar", "RoundCorneredProgressBar\RoundCorneredProgressBar.csproj", "{B2A527E0-88FF-42F9-B54C-E8D47DFDCFC7}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCProgressBarExamples", "RCProgressBarExamples\RCProgressBarExamples.csproj", "{B8437846-7DFE-40DE-82F3-FEA590DBE456}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {B2A527E0-88FF-42F9-B54C-E8D47DFDCFC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {B2A527E0-88FF-42F9-B54C-E8D47DFDCFC7}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {B2A527E0-88FF-42F9-B54C-E8D47DFDCFC7}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {B2A527E0-88FF-42F9-B54C-E8D47DFDCFC7}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {B8437846-7DFE-40DE-82F3-FEA590DBE456}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {B8437846-7DFE-40DE-82F3-FEA590DBE456}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {B8437846-7DFE-40DE-82F3-FEA590DBE456}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {B8437846-7DFE-40DE-82F3-FEA590DBE456}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /RoundCorneredProgressBar/RoundCorneredProgressBar.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B2A527E0-88FF-42F9-B54C-E8D47DFDCFC7} 8 | Library 9 | Properties 10 | RoundCorneredProgressBar 11 | RoundCorneredProgressBar 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Component 46 | 47 | 48 | 49 | 50 | 57 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RCProgressBarExamples.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RCProgressBarExamples.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RCProgressBarExamples/RCProgressBarExamples.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B8437846-7DFE-40DE-82F3-FEA590DBE456} 8 | WinExe 9 | Properties 10 | RCProgressBarExamples 11 | RCProgressBarExamples 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\RoundCorneredProgressBar\bin\Debug\RoundCorneredProgressBar.dll 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Form 52 | 53 | 54 | Form1.cs 55 | 56 | 57 | 58 | 59 | Form1.cs 60 | 61 | 62 | ResXFileCodeGenerator 63 | Resources.Designer.cs 64 | Designer 65 | 66 | 67 | True 68 | Resources.resx 69 | 70 | 71 | SettingsSingleFileGenerator 72 | Settings.Designer.cs 73 | 74 | 75 | True 76 | Settings.settings 77 | True 78 | 79 | 80 | 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /RoundCorneredProgressBar/RoundCorneredProgressBar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Drawing.Drawing2D; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace RoundCorneredProgressBar 12 | { 13 | public partial class RoundCorneredProgressBar : PictureBox 14 | { 15 | private Timer t = new Timer(); 16 | 17 | double pbUnit; 18 | int pbWIDTH, pbHEIGHT, pbComplete; 19 | 20 | Bitmap bmp; 21 | Graphics g; 22 | 23 | public RoundCorneredProgressBar() 24 | { 25 | DoubleBuffered = true; 26 | ProgressBarColor = Color.FromArgb(224, 224, 224); 27 | ProgressBackColor = Color.FromArgb(255, 128, 255); 28 | ProgressFont = new Font(Font.FontFamily, (int)(this.Height * 0.7), FontStyle.Bold); 29 | ProgressFontColor = Color.Black; 30 | Value = 0; 31 | } 32 | 33 | public int Value { get; set; } 34 | 35 | [Category("Appearance")] 36 | public Color ProgressBarColor { get; set; } 37 | 38 | [Category("Appearance")] 39 | public Color ProgressBackColor { get; set; } 40 | 41 | [Category("Appearance")] 42 | public Font ProgressFont { get; set; } 43 | 44 | [Category("Appearance")] 45 | public Color ProgressFontColor { get; set; } 46 | 47 | 48 | private GraphicsPath GetRoundRectagle(Rectangle bounds) 49 | { 50 | GraphicsPath path = new GraphicsPath(); 51 | int radius = bounds.Height; 52 | if (bounds.Height <= 0) radius = 20; 53 | path.AddArc(bounds.X, bounds.Y, radius, radius, 180, 90); 54 | path.AddArc(bounds.X + bounds.Width - radius, bounds.Y, radius, radius, 270, 90); 55 | path.AddArc(bounds.X + bounds.Width - radius, bounds.Y + bounds.Height - radius, 56 | radius, radius, 0, 90); 57 | path.AddArc(bounds.X, bounds.Y + bounds.Height - radius, radius, radius, 90, 90); 58 | path.CloseAllFigures(); 59 | return path; 60 | } 61 | private void RecreateRegion() 62 | { 63 | var bounds = new Rectangle(this.ClientRectangle.Location, this.ClientRectangle.Size); 64 | bounds.Inflate(-1, -1); 65 | this.Region = new Region(GetRoundRectagle(bounds)); 66 | this.Invalidate(); 67 | } 68 | protected override void OnSizeChanged(EventArgs e) 69 | { 70 | base.OnSizeChanged(e); 71 | this.RecreateRegion(); 72 | } 73 | 74 | /// 75 | /// start the animation of filling the progress bar 76 | /// 77 | public void Animate() 78 | { 79 | pbWIDTH = this.Width; 80 | pbHEIGHT = this.Height; 81 | 82 | pbUnit = pbWIDTH / 100.0; 83 | 84 | //% [min = 0 max = 100] 85 | pbComplete = 0; 86 | 87 | bmp = new Bitmap(pbWIDTH, pbHEIGHT); 88 | 89 | //timer 90 | this.t.Interval = 50; 91 | this.t.Tick += new EventHandler(this.t_Tick); 92 | this.t.Start(); 93 | } 94 | 95 | private void t_Tick(object sender, EventArgs e) 96 | { 97 | //graphics 98 | g = Graphics.FromImage(bmp); 99 | g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; 100 | g.SmoothingMode = SmoothingMode.HighQuality; 101 | 102 | //clear graphics 103 | g.Clear(ProgressBackColor); 104 | 105 | GraphicsPath path = new GraphicsPath(); 106 | Rectangle innerBounds = new Rectangle(0, 0, (int)(pbComplete * pbUnit), pbHEIGHT); 107 | 108 | //progressbar region filling 109 | Region r = new Region(GetRoundRectagle(innerBounds)); 110 | 111 | g.FillRegion(new SolidBrush(ProgressBarColor), r); 112 | 113 | //draw string 114 | g.DrawString(pbComplete + "%", new Font(ProgressFont.FontFamily, (int)(pbHEIGHT * 0.6), ProgressFont.Style), new SolidBrush(ProgressFontColor), new PointF(pbWIDTH / 2 - pbHEIGHT, pbHEIGHT / 10)); 115 | 116 | //load bitmap in picturebox picboxPB 117 | this.Image = bmp; 118 | 119 | //update pbComplete 120 | pbComplete++; 121 | if (pbComplete > Value) 122 | { 123 | //dispose 124 | g.Dispose(); 125 | this.t.Stop(); 126 | } 127 | 128 | } 129 | 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /RCProgressBarExamples/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace RCProgressBarExamples 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.roundCorneredProgressBar3 = new RoundCorneredProgressBar.RoundCorneredProgressBar(); 32 | this.roundCorneredProgressBar2 = new RoundCorneredProgressBar.RoundCorneredProgressBar(); 33 | this.roundCorneredProgressBar1 = new RoundCorneredProgressBar.RoundCorneredProgressBar(); 34 | this.button1 = new System.Windows.Forms.Button(); 35 | ((System.ComponentModel.ISupportInitialize)(this.roundCorneredProgressBar3)).BeginInit(); 36 | ((System.ComponentModel.ISupportInitialize)(this.roundCorneredProgressBar2)).BeginInit(); 37 | ((System.ComponentModel.ISupportInitialize)(this.roundCorneredProgressBar1)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // roundCorneredProgressBar3 41 | // 42 | this.roundCorneredProgressBar3.BackColor = System.Drawing.SystemColors.ButtonShadow; 43 | this.roundCorneredProgressBar3.Location = new System.Drawing.Point(12, 155); 44 | this.roundCorneredProgressBar3.Name = "roundCorneredProgressBar3"; 45 | this.roundCorneredProgressBar3.ProgressBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); 46 | this.roundCorneredProgressBar3.ProgressBarColor = System.Drawing.Color.Lime; 47 | this.roundCorneredProgressBar3.ProgressFont = new System.Drawing.Font("Lucida Handwriting", 35.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 48 | this.roundCorneredProgressBar3.ProgressFontColor = System.Drawing.Color.Black; 49 | this.roundCorneredProgressBar3.Size = new System.Drawing.Size(377, 27); 50 | this.roundCorneredProgressBar3.TabIndex = 2; 51 | this.roundCorneredProgressBar3.TabStop = false; 52 | this.roundCorneredProgressBar3.Value = 100; 53 | // 54 | // roundCorneredProgressBar2 55 | // 56 | this.roundCorneredProgressBar2.BackColor = System.Drawing.SystemColors.ActiveCaptionText; 57 | this.roundCorneredProgressBar2.Location = new System.Drawing.Point(12, 50); 58 | this.roundCorneredProgressBar2.Name = "roundCorneredProgressBar2"; 59 | this.roundCorneredProgressBar2.ProgressBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); 60 | this.roundCorneredProgressBar2.ProgressBarColor = System.Drawing.Color.Aqua; 61 | this.roundCorneredProgressBar2.ProgressFont = new System.Drawing.Font("Monotype Corsiva", 35.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); 62 | this.roundCorneredProgressBar2.ProgressFontColor = System.Drawing.Color.Black; 63 | this.roundCorneredProgressBar2.Size = new System.Drawing.Size(377, 99); 64 | this.roundCorneredProgressBar2.TabIndex = 1; 65 | this.roundCorneredProgressBar2.TabStop = false; 66 | this.roundCorneredProgressBar2.Value = 70; 67 | // 68 | // roundCorneredProgressBar1 69 | // 70 | this.roundCorneredProgressBar1.BackColor = System.Drawing.SystemColors.ActiveCaption; 71 | this.roundCorneredProgressBar1.Location = new System.Drawing.Point(12, 12); 72 | this.roundCorneredProgressBar1.Name = "roundCorneredProgressBar1"; 73 | this.roundCorneredProgressBar1.ProgressBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); 74 | this.roundCorneredProgressBar1.ProgressBarColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); 75 | this.roundCorneredProgressBar1.ProgressFont = new System.Drawing.Font("Microsoft Sans Serif", 35F, System.Drawing.FontStyle.Bold); 76 | this.roundCorneredProgressBar1.ProgressFontColor = System.Drawing.Color.Black; 77 | this.roundCorneredProgressBar1.Size = new System.Drawing.Size(377, 32); 78 | this.roundCorneredProgressBar1.TabIndex = 0; 79 | this.roundCorneredProgressBar1.TabStop = false; 80 | this.roundCorneredProgressBar1.Value = 67; 81 | // 82 | // button1 83 | // 84 | this.button1.Location = new System.Drawing.Point(136, 266); 85 | this.button1.Name = "button1"; 86 | this.button1.Size = new System.Drawing.Size(127, 38); 87 | this.button1.TabIndex = 3; 88 | this.button1.Text = "button1"; 89 | this.button1.UseVisualStyleBackColor = true; 90 | this.button1.Click += new System.EventHandler(this.button1_Click); 91 | // 92 | // Form1 93 | // 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 96 | this.ClientSize = new System.Drawing.Size(401, 349); 97 | this.Controls.Add(this.button1); 98 | this.Controls.Add(this.roundCorneredProgressBar3); 99 | this.Controls.Add(this.roundCorneredProgressBar2); 100 | this.Controls.Add(this.roundCorneredProgressBar1); 101 | this.Name = "Form1"; 102 | this.Text = "Form1"; 103 | ((System.ComponentModel.ISupportInitialize)(this.roundCorneredProgressBar3)).EndInit(); 104 | ((System.ComponentModel.ISupportInitialize)(this.roundCorneredProgressBar2)).EndInit(); 105 | ((System.ComponentModel.ISupportInitialize)(this.roundCorneredProgressBar1)).EndInit(); 106 | this.ResumeLayout(false); 107 | 108 | } 109 | 110 | #endregion 111 | 112 | private RoundCorneredProgressBar.RoundCorneredProgressBar roundCorneredProgressBar1; 113 | private RoundCorneredProgressBar.RoundCorneredProgressBar roundCorneredProgressBar2; 114 | private RoundCorneredProgressBar.RoundCorneredProgressBar roundCorneredProgressBar3; 115 | private System.Windows.Forms.Button button1; 116 | } 117 | } 118 | 119 | --------------------------------------------------------------------------------