开发者

Adapt column width of a Listview to its content

开发者 https://www.devze.com 2023-03-08 14:35 出处:网络
I load a listview with several items and I would like to adapt the width of the listview to its content. Unfortunately, this doesn\'t wor开发者_开发技巧k.

I load a listview with several items and I would like to adapt the width of the listview to its content. Unfortunately, this doesn't wor开发者_开发技巧k. I'm working on windows CE with the compact Framework .NET and I've already tried to set the width of the column to "-1" and "-2" as mentionned on MSDN. But no result so far...

Does anyone could help me on that...


According to the [MSDN page] on column widths:

This property enables you to set the Width of the ColumnHeader. The ColumnHeader can be set to adjust at run time to the column contents or heading. To adjust the width of the longest item in the column, set the Width property to -1. To autosize to the width of the column heading, set the Width property to -2

For your purposes you should be setting the column width to -1. Note that you will have to do this after adding the items to the list.

0

精彩评论

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

关注公众号