 |
|
 |
Hello,
The Zip-File ist corrupted! Please update your file
Greez
TmG
|
|
|
|
 |
|
 |
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.
|
|
|
|
 |
|
|
 |
|
 |
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
|
|
|
|
 |
|
 |
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.
|
|
|
|
 |
|
 |
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 (main.Width - (2*this._ringThickness) < 1 || main.Height -(2*this._ringThickness) <= 1)
return;
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);
}
grp.FillRegion(targetBrush, mainRegion);
}
}
}
}
}
|
|
|
|
 |
|
 |
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
|
|
|
|
 |
|
 |
Thanks Izzet Kerem Kusmezer,
I confirm the memory leak problem in Windows 7.
I have tried your solution and it really works.
Congratulations for both you, creator and contributor for the initiative.
|
|
|
|
 |
|
 |
Pretty impressive, would look better anti-aliased though.
Still, props
|
|
|
|
 |
|
 |
Hi,
What do you mean by anti-aliased?
Thanks.
|
|
|
|
 |
|
 |
the Graphics object has a smoothing mode property. Try setting it to anti-alias
|
|
|
|
 |
|
 |
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
|
|
|
|
 |
|
 |
Hi,
I also provided source code of the project. You should be able to compile it from scratch.
Thanks.
|
|
|
|
 |
|
 |
Any chance you could make this available under the Code Project Open License instead of GPL?
Thanks.
|
|
|
|
 |
|
 |
Why would you want to have different license Phil?
|
|
|
|
 |
|
 |
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.
|
|
|
|
 |
|
 |
QHN_PROF@Yahoo.com
|
|
|
|
 |
|
 |
Hey Qasem,
Thank you. I am glad you found it useful.
|
|
|
|
 |