开发者

Winforms: How to create a listbox with variable item height

开发者 https://www.devze.com 2023-01-25 21:51 出处:网络
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.

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

精彩评论

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