Listview columnwidth

  • Thread starter Thread starter Rikki
  • Start date Start date
R

Rikki

Hi

Is there a way to program a Listview control to
automatically adjust its columnwidths so it fits the
contents of the columns?

I have two columns in a listview, but havent found out how to do this yet.

thanks.
 
Rikki said:
Is there a way to program a Listview control to
automatically adjust its columnwidths so it fits the
contents of the columns?

I have two columns in a listview, but havent found out how to do this
yet.

Set the width to "-1" and it will resize to fit the content...
If you set the last column to "-2" it will resize to the end...

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp

Do you need daily reports from your server?
http://sourceforge.net/projects/srvreport/
 
Hi Rikki,

To size the column width to the longest item in the column use...

columnHeader1.Width = -2;

...and to size the column width to the column header text use...

columnHeader1.Width = -1;

HTH,
Gary
 
Back
Top