I need to build a Windows control that displays KPI indicators. Something similar to the one displayed at the following picture.
alt text http://www.novolocus.com/wp-content/uploads/2008/03/normal.JPG
There are also the following requirements:
- List needs to refresh from a background thread every ~15 seconds
- It needs to handle 100+ indicators
My initial idea was to use FlowLayoutPanel with a combination of a label and picturebox (for each row). I managed to create exactly the same thin开发者_运维知识库g but as list grows and refreshes itselft, UI becomes unresponsive and memory footprint is increasing.
I tried the same approach with GridView and some 3rd party components but every time the result was similar UI would eventually freeze completely because it could not handle that many items refreshing.
So, how would you approach this problem, what would you do create this control, which objects would you choose to build UI and how would you refresh it. (If there is a 3rd party control that looks good that might also work for me).
A layout like that should not lead to an increasing memory footprint, or a slowdown.
Your description sounds more like a resource leak in your control (not Disposing graphic objects). Make sure that you know that the IDisposable
interface implies the need of using(){}
for Brush, Graphics and Image objects.
A short sample:
using (Graphics g = Graphics.FromImage(picture))
using (Brush fill = new SolidBrush(Color.Yellow))
{
g.FillRectangle(fill, x0, y0, x1, y1);
}
精彩评论