This custom control displays a left scrolling spike with range configurable by calling SetRange(0,100), the first parameter is the min(bottom) value and the second parameter is max(top) value.
The control is designed to work just like the progress control but with a twist. Every SetPos() will shows a spike and the next SetPos() will scroll the previous one to the left.
The CHistogramCtrl class is derived from CWnd, the header and code are in HistogramCtrl.h and HistogramCtrl.cpp files.
In your dialog box, you must create the control as static control (use "picture" from control toolbar). You must set the properties to
- Type: Rectangle, and
- Color: black. (I think black background looks better)
Don't worry about the height, width and border, the control will ajust itself and draw the border for you.
First add a member to your dialog class like this:
class CHistogramTestDlg : public CDialog
And in the initial dialog box...
m_HistogramCtrl.Create(WS_VISIBLE | WS_CHILD, rect, this, 100);
return TRUE; // return TRUE unless you set the focus to a control
And the rest use SetPos(UINT nValue).
The custom control uses unique painting technique which is a little bit to long to discuss here. If you want to understand more please email your FAQ to firstname.lastname@example.org thanks. (The code is not as long to read)
Here is an example of how an application looks like with the control.
Last updated: 17 May 1998