views:

655

answers:

1

As far as I know ON_WM_MEASUREITEM does not get called in Custom Draw list control. It is only used if control is Owner Drawn. I have found a way to do that, but it is somewhat a HACK and I still can not control gaps between items they are set up somehow automatically. The trick is that you can create CImageList with the unused images of the size you need and if you assign such image list to the list control, items get resized to the dimensions close to the size of the images. After that you can use Custom Draw to paint whatever inside those enlarged items.

CImageList m_imageList1;
m_imageList1.Create(176, 144, ILC_COLOR32 | ILC_MASK, 5, 1);
GetListCtrl().SetImageList(&m_imageList1, LVSIL_NORMAL);

So the question is how do you change items size and spacing between them in Custom Drown control? Or a fully Owner Drawn control with LVS_OWNERDRAWFIXED is my only option here?

A: 

Update.
I have compiled the same custom drawn list control in VS2008. And the look was different. The item size was perfect, and no gaps between the items. I guess that sizing problem I had was only in MFC for VS2003, I was using initially.
Man, MFC is a constant HACK spree :-)

I guess the question is closed.
Thank you (me).

Ma99uS