Recently, one of the projects that I'm working on required showing some variable data, like signal strength, signal to noise ratio etc. As usual, I dived into Code Project, confident that I'll find a solution. I did find some, as expected, but unfortunately, none of them fit my requirements. First of all, I needed to show variables of different type, i.e. the control needed to have multiple bands. Secondly, the code needed to be windows CE compliant.
After some review, I choose Mehdi Mousavi's CHistogramCtrl, which was good enough to be portable to windows CE. All I did was add some modifications to include multiple bands support and that's it.
Using the code
Using the code is pretty simple. All you do is add bands to the control using new instances of the
COscilloscopeBand object. For example in the dialog's
RGB(0x99, 0xFF, 0x66), 1, 1, 100));
RGB(0, 0, 255), 1, 1, 200));
m_Oscilloscope.Create(WS_VISIBLE | WS_CHILD, rect, this,
You can set the position of a band by calling its
SetPos method. You must also call
DrawBands each time you want to update the display.
COscilloscopeCtrl also contains some other helpful methods to modify the individual bands Pen width, color etc. Check out the source code.
Draw some sort of a legend to describe a band. I included a band name for a band's constructor for that purpose, but never got around doing it. Some help!