Robinson
Robinson

Reputation: 10122

Combobox in Dropdown List mode - making list item height different from combo-box item height?

I want to implement a combobox (in drop-down list mode), where the items in the drop-down list are 64 in height, but where the dropdown list item displays itself at normal height. The use case here is a list containing file names with an image thumbnail next to it. I want the ordinary display to be normal height with a small thumbnail, but much larger thumbnails in the associated drop-down list.

When I've tried modifying the item height, the entire combobox is set to accommodate it, not just the drop-down list (entirely reasonably I suppose).

Is this possible?

Thanks for any tips.

Robin

Upvotes: 0

Views: 1479

Answers (2)

Spevy
Spevy

Reputation: 1325

I believe you need to make the Combobox owner drawn and use the Measure event. The Event passes the MeasureItemEventArgs which includes the index to the item being drawn.

Here is a sample from Microsoft's documentation Combobox.Measure event

Upvotes: 1

Niclas
Niclas

Reputation: 1230

Perhaps you could use the OwnerDraw mode? This example shows an example with a custom height separator item, but i guess you could apply the same principle to all items in the combo-box..

http://blogs.msdn.com/b/jfoscoding/archive/2005/08/26/456977.aspx

Upvotes: 1

Related Questions