CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    381

    Autosize columns in a ListView

    I don’t find a way to autosize columns i a ListView depending on its contents…
    ...and justice for all

  2. #2
    Join Date
    Mar 2008
    Location
    Atlanta, GA
    Posts
    49

    Re: Autosize columns in a ListView

    Yep, set the width of the ColumnHeader objects to -2. For instance:

    Code:
    foreach (ColumnHeader ch in lvList.Columns)
    {
      ch.Width = -2;
    }
    Try it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured