Tall Listbox Items Have WM_DRAWITEM With Wrong rcItem Height.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello Folks:

Developing a 32 bit application on Win7/64 Ultra, VS 2010, WIN32 no MFC.

I need to display a list of custom drawn items, with items of different heights.

I seem to be unable to get a tall ListBox item to display with a proper height.

A height of 1248, is set in the MEASUREITEMSTRUCT, for the ListBoxs third item.

WM_MEASUREITEM for the third item in this list returns with an itemHeight of 1248 set in the MEASUREITEMSTRUCT. This is a UINT, so 1248 shouldnt be a problem.

When servicing the WM_DRAWITEM message for the third item, the DRAWITEMSTRUCTs rcItem.top value of 144, which is correct for the third item.

The problem is the rcItem.bottom value of 368! Thats a height of 224, not 1248.

1248 - 224 = 1024.

I thought this might be some modulo 1024, but designating a height of 1020 results in a drawing rectangle with a height of 252.

reItem.bottom is a LONG. It should be able to handle a value of 1248.

I dont see anything in the ListBox documentation about limits on the height of a ListBox item.

What am I doing wrong?

Thanks
Larry

View the full article
 
Back
Top