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?

Ma99uS
  • 10,605
  • 8
  • 32
  • 42
  • Is the whole point of your images just to bump the size of your items? That's the hack? Just trying to get a handle on your question... – Aardvark Oct 24 '08 at 19:53
  • I create and assign the list of images which I never gonna use. I am tricking the control into thinking that it has to display those images, so it has to allocate bigger real estate for every item. – Ma99uS Oct 26 '08 at 14:42
  • So if you have to trick the system into doing what you want in some non direct way, that qualifies as a HACK in my book. :-) – Ma99uS Oct 26 '08 at 14:43

1 Answers1

1

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
  • 10,605
  • 8
  • 32
  • 42