C# ListView disable column size change with header divider

disrupt used Ask the Experts™
I want to disable column sizing when you use the header divider to change the size of the columns. I know you can set the HeaderStyle to None and it will do it but I want the Header as well.  How can I do this?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
One thing that you can do is handle the ColumnWidthChanging event of listview and in that event make the listview size as it is currently.
I have given the code here so try this.
private void listView1_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
            e.NewWidth = listView1.Columns[e.ColumnIndex].Width;
            e.Cancel = true;

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial