 |
|
 |
This is the one I've been looking for for a couple of months, since I like the way Nero Suite's circular progress control, i.e. a circular progress indicator with transparent background. Unfortunately, I am C++ developer not C#. I will try to port it to C++ but due to my limited knowledge, I doubt I can do it. So if you plan to have porting it to MFC, I would appreciate it.
Thanks for your article.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Once that the Progress Circle is displayed, memory consumption increases continually until the application is terminated. I confirmed this trouble by the Task Manager of Win XP. Why?
Yuyama
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Yuyama,
There cant be memory leak since memory is managed by garbage collector. Graphics object could be using a lot of memory but eventually it should be cleaned up by GC (Garbage Collector).
Thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Actually the memory leak was caused by DrawFilledArc portion of your code Replace the section with the following code, which doesn't creates a new SolidBrush each time the DrawFilledArc gets created, solves the problem. Also i am disposing the GraphicsPath, Region objects. The memory usage in this way stays the same.
private System.Collections.Generic.Dictionary<Color, SolidBrush> _brushCache = new System.Collections.Generic.Dictionary<Color,SolidBrush>();
private void DrawFilledArc (Graphics grp, Color color, int startAngle) { grp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Rectangle main = this.ClientRectangle; // If there is no region to be drawn, then this method terminates itself if (main.Width - (2*this._ringThickness) < 1 || main.Height -(2*this._ringThickness) <= 1) return;
// Calculates the region that will be filled
using (GraphicsPath outerPath = new GraphicsPath()) { outerPath.AddPie(main, startAngle, this.PieAngle);
Rectangle sub = new Rectangle(main.X + this._ringThickness, main.Y + this._ringThickness, main.Width - (2 * this._ringThickness), main.Height - (2 * this._ringThickness));
using (GraphicsPath innerPath = new GraphicsPath()) { innerPath.AddPie(sub, startAngle - 1, this.PieAngle + 2);
using (System.Drawing.Region mainRegion = new Region(outerPath)) { using (System.Drawing.Region subRegion = new Region(innerPath)) {
mainRegion.Exclude(subRegion); SolidBrush targetBrush; if (_brushCache.ContainsKey(color)) { targetBrush = _brushCache[color]; } else { targetBrush = new SolidBrush(color); _brushCache.Add(color,targetBrush); } // Fill that region grp.FillRegion(targetBrush, mainRegion); } } } } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Kerem,
Thanks for the explanation. When I initially developed this windows control, .net framework 2.0 was in the market. I carefully examined the heap usage and it seemed there were no memory leaks in the control.
If you guys believe there is though, I hope your solution fixes it.
Thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
Hi Umut Tezduyar, I found your article interesting because I need a different Visual ProgressBar from usually MS ProgressBar. I downloaded your solution. I extracted the zip file and loaded in Visual Studio. I run... In instruction Initialize Components (the first instruction of the code) program stops and errors says "Impossible to load file or assembly 'ProgressCircle, Version=...., PublicKeyToken=....'. Impossible to warrant the authorization. (Exception HRESULT: 0x80131417).
In ProgressCircle project there is a key.snk file maybe the project is protected. I have no idea. Thanks in advance, Mauro
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
I "might" use a derivative of this in a commercial app (I have some ideas, and have already fixed a couple of bugs in it), but not if it's GPL--I simply can't afford that exposure. The CPOL is much less restrictive. I'm not an expert on this stuff, but that's my understanding. My impression is that much of the code on CodeProject is CPOL, which is great. Thanks.
|
| Sign In·View Thread·PermaLink | 4.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |