I don’t now how many times I wanted to be able to show a progress bar in the list control. The list control is a versatile control and it is really neat when anybody wants to display some data in tabular form. But it does not come with a built in progress bar.
So I tried to use the owner drawn and custom drawn controls. But they could not match the look and feel of the Windows default progress bar.
So I decided to make the progress control a child of the control and set the progress position to the numeric text of the respective box.
The trick was to capture the
WM_PAINT message and then to create a series of progress controls in the right place.
// TODO: Add your message handler code here
// Do not call CListCtrl::OnPaint() for painting messages
// if the count in the list os nut zero
// delete all the progress controls and them procede
// get the rect
// create the progress control and set their position
CProgressCtrl* pControl=new CProgressCtrl();
// set the position on the control
// add them to the list
So the list control paints the data in the correct position, and the progress controls being the child windows, stay on the top of the
ListCtrl thus making an illusion of being in the place of normal text.