开发者

Winforms: How to create a listbox with variable item height

I need a simple listbox control where height for each item varies. And then i to need draw a custom image for each i开发者_StackOverflow社区tem.

Basically item_height would be equal to (listbox_width / image_width ) * image_height.

Normally I would just take a listbox and specify on paint event, but i need a variable height for each item.

Is there a simple way to get a list box with items of variable height?


You can set the DrawMode property of your ListBox control to OwnerDrawVariable and handle its MeasureItem and DrawItem events.


There is a MeasureItem event. Don't forget to set DrawMode to OwnerDrawVariable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜