Question

Thanks coming!!

i want to adjust the item's height.look like this one:

enter image description here

but actually it is :

enter image description here

and i find 3 way to adjust the item height:

(1). add the picture but text is not in center.

m_ImageListCList.Create(16,36/*Here*/,ILC_COLOR24|ILC_MASK,$Cnt ,$Cnt);
m_ImageListCList.Add(&Bitmap2, RGB(192, 192, 192));
m_listSchedule.SetImageList(&m_ImageListCList, LVSIL_SMALL);

enter image description here

(2). edit the Font size , it's not pretty

enter image description here

(3). and i want to overwrite the DrawItem() MeasureItem() function of it.

virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
ON_WM_MEASUREITEM_REFLECT()
ON_WM_DRAWITEM()

but MeasureItem() is work, DrawItem() couldn't called. and then i find this context

MSDN Knowledge Base Q131788: The LVS_OWNERDRAWFIXED style is only compatible with the LVS_REPORT style. You cannot have an owner drawn ListView with the LVS_ICON, LVS_SMALLICON or LVS_LIST style.

Now , i don't have better idea ... thanks a lot about your help!!

Was it helpful?

Solution

When MeasureItem works you can size your items, but did you try NM_CUSTOMDRAW. AFAIK it should work to.

If you only need to display an icon and some text and want to pick and select data, wouldn't a list box be sufficient? Use a classic ListBox and some Ownerdraw mechansim.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top