C# ListView Disable Horizontal Scrollbar

Ozzy picture Ozzy · Dec 17, 2010 · Viewed 27k times · Source

is there a way I can stop the horizontal scroll bar from ever showing up in a listview? I want the vertical scroll bar to show when needed but I want the horizontal scroll bar to never show up.

I would imagine it would have something to do with WndProc?

Thanks

Answer

Dean McCoy picture Dean McCoy · May 4, 2015

There is a much simpler way to eliminate the lower scroll bar and have the vertical showing. It consists of making sure the header and if no header the rows are the width of the listview.Width - 4 and if the vertical scroll bar is show then listview.Width - Scrollbar.Width - 4;

the following code demostrates how to:

lv.Columns[0].Width = lv.Width - 4 - SystemInformation.VerticalScrollBarWidth;