You'll find that the row height calculation, as shown, is not quite enough. This will be evident when your rows are cut off.
The problem is that lf.lfHeight gives the height of the font WITHOUT accounting for what is called "external leading," which represents the extra pixels required to write out characters like p and q that have pixels falling under the font's baseline. To get this external leading value, you need to use GetTextMetrics. Just replace the above row height calculation code with the following:
Use two imaglists:
//In definition file:
//Somewhere at initialization, m_height1 and m_height2
//contains the desired heights
m_height1 = 10;
m_height2 = 10;
//Togle the item height by caling
//The image index can be set to -1, of the image lists
//contains some images.
If you do not recieve the WM_MEASUREITEM message after doing all of this, you are in the same boat I was. I was programing in Modula II, but some of you may have the same problem. If I SendMessage WM_WINDOWPOSCHANGED, or MoveWindow and I don't actually move the window, I don't recieve the WM_MEASUREITEM message. My solution was to move the window just a bit and then just move it right back. It may not be the best solution, but it worked, and I didn't see any flashing so I was happy.
If you want to and now can't receive WM_MEASUREITEM ,you can Send some messages such as WM_WINDOWPOSCHANGED to intrige this message. So,you can use FuncToMEASUREITEM() in any time such as initializing listctrl header or items,but you must keep in mind WM_MEASUREITEM is a message sent when listctrl has been , FuncToMEASUREITEM() must be used when your listctrl have been created. Thanks.