Listview Column Header Autosize Bug ?

C

Cybertof

Hello,

Do you know why in the following code the result is a column of size 0 ?
(in the doc it says to use -2 to autosize column header...)

ColumnHeader MyColumnHeader = new ColumnHeader();
MyColumnHeader.Text = "col1";
MyColumnHeader.Width = -2; // if you remove this line col appears
MyListView.Columns.Add(MyColumnHeader);

ListViewItem MyItem = new ListViewItem("item 1",0);
MyItem.SubItems.Add("sub1");
MyItem.SubItems.Add("sub2");
MyListView.Items.Add(MyItem);


How to automatic adjust a column size to its content ?
(is the documentations faulty about "width" property ?)


Regards,
Cybertof.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top