Auto-resizing a listview column

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi folks,

I've got a listview with several columns, and I'm trying to
automatically resize the columns when the control gets painted. I know
there are methods for this in .NET 2 but we're not using it yet, so
I've gotta get it working the old-fashioned way.

There's built-in functionality for this already. If the user
double-clicks on a coumn divider the listview control auto resizes the
column nicely. I'm just trying to do the same thing programmatically.
Is there some way for me to raise a divider double click event in c#?
I can't seem to find it. Or maybe I can call the event handler that's
built into the listview and resize that way.

Any ideas?

Thanks,

B

.



Relevant Pages

  • Re: Auto-resizing a listview column
    ... I've got a listview with several columns, ... automatically resize the columns when the control gets painted. ... double-clicks on a coumn divider the listview control auto resizes the ... Or maybe I can call the event handler that's ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: listview vertical scrollbar width
    ... ListView control encapsulates Windows build-in List-View to leverage its ... Windows has two kinds of scroll bars. ... You may use Spy++ to view ListView control structure and its windows style ... considered the non-client area of ListView, so this WS_VSCROLL scrollbar is ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: WMP control resizing
    ... > getting the WMP9 activex control in a window and playing movies etc. ... when you want to resize the control in MFC, ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Trap double-click on form title bar
    ... >>> resize event that adjusts the column widths of a listview control ... If you put a breakpoint in the Resize ... > (Grid details) ... > ExtendedCost col width = 2805 ...
    (microsoft.public.vb.general.discussion)
  • Re: ListView vs CheckListBox
    ... The application UI has a List View control and a Text Box and a Button. ... list view displays a list of files with checkboxes besides each file name. ... ListView.CheckedListViewItemCollection checkedItems = ... > is displayed with in my ListView, ...
    (microsoft.public.dotnet.languages.csharp)