Listview Column Header Autosize Bug ?

  • Thread starter Thread starter Cybertof
  • Start date Start date
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.
 
Back
Top