Click here to Skip to main content
13,358,079 members (57,698 online)
Click here to Skip to main content
Add your own
alternative version


39 bookmarked
Posted 6 Jun 2010

Customizable Tracker Control

, 6 Jun 2010
Rate this:
Please Sign up or sign in to vote.
Windows Forms Control to visualize performance counters


A while ago, I stumbled over an article written by Andelko Pavelic. I looked into the code and found it to be an interesting approach. But I needed something more stable, accurate and flexible - and I needed better looks. So I took the base idea and wrote my own version, the TrackerControl 2.0. Although almost nothing is left of Andelko's initial code, credits belong to him for providing the initial idea.

Using the Code

There is a bunch of additional features and properties added to the original control.

First of all, the coloring of the drawn graph is extended to optionally use a linear color gradient:


To make it more plastic, the area underneath the graph can be colorized:


The grid can be adjusted in mesh size and optionally horizontal and/or vertical grid lines can be blanked:


The wider the control, the more values are represented by the graph. I found it helpful in some cases to visualize the average as a horizontal bar:


The average bar's color can also be set to a linear gradient, other than the one of the graph.

There are some features that can hardly be shown with still pictures, such as:

GridMovement.MoveWithGraph and GridMovement.Fixed

The grid can progressively move with the graph or stay fixed in the background.


This is the classic mode, known from the Windows Task Manager.


While still in line with values between Minimum and Maximum and colorizing the graph according to these fixed bounds, the vertical zoom level is continuously adjusted to the highest displayed value. That gives more granularity during periods of low values at a constant control height. The distance between the horizontal grid lines is adjusted as well (if shown), according to the zoom level.


Sometimes the exact Maximum isn't known and it would be laborious to manually adjust the controls Maximum in your code during runtime. This setting does exactly that, correcting the Control's internal maximum continuously to the highest shown value. In difference to GraphSizeMode.Zoom, the graph's color gradient is fully utilized. The Maximum value in AutoAdjustMaximum acts as the initial internal maximum and also as the internal lower bound for its auto adjustment.

TrackerRefreshInDesignMode, TrackerRefreshInRuntimeMode and TrackerRefreshStartOnFirstValue

These settings do exactly as the names imply: The first one eventually saves you from headache caused by watching moving grid lines while designing the form and the second is useful to halt and resume the TrackerControl during runtime. The third prevents the Control from refreshing until it gets the first value to be drawn.


Depending on the area of application, sometimes the start value of the graph needs to be other than 0.


Flushes the internal value buffer and clears the graph.

Points of Interest

Combining the settings help to customize visualization. They can also be changed during runtime, allowing interesting visual effects.

Keep in mind that there is no error handling implemented. Eventually, you need to do this yourself according to your application's exception handling strategy.


  • 6th June, 2010: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Germany Germany
No Biography provided

You may also be interested in...


Comments and Discussions

Questionhigh consumtion CPU Pin
spiritdead7-Oct-12 12:48
memberspiritdead7-Oct-12 12:48 
GeneralPretty good stuff. Pin
Md. Marufuzzaman11-Jul-10 23:42
mvpMd. Marufuzzaman11-Jul-10 23:42 
GeneralLooks Great! Pin
Shane Story9-Jun-10 5:36
memberShane Story9-Jun-10 5:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 6 Jun 2010
Article Copyright 2010 by BTDex
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid