tempy
tempy

Reputation: 1557

Horizontal scroll winforms listview

Anyone know if its possible to enable horizontal scrolling ONLY in a windows forms listview (viewmode set to large icons). What I want to do is make a listview whose height is sufficient to only show one row of icons, and I don't want to have multiple rows. Just one very long row that a user would have to scroll horizontally to get to out-of-range icons. If I make the listview scrollable then it automatically makes multiple rows and puts in a vertical scrollbar, which I don't want.

Thanks in advance!

Upvotes: 7

Views: 24823

Answers (2)

Tarek HAMZA
Tarek HAMZA

Reputation: 1

Just set one of the columns widths to: -2. the scroll bar will appear:

public Form1()
    {Listview1.Columns.Add("Name", 100, HorizontalAlignment.Center);
     Listview1.Columns.Add("Item Name", -2, HorizontalAlignment.Center);
     Listview1.Columns.Add("Item Link", 300, HorizontalAlignment.Center);
     }

When setting one or more of the columns width to -2, the scroll bar appears, I don't know why actually, but I had this problem because I fixed the width by creating an event that disables width change.

Upvotes: 0

Fredrik Mörk
Fredrik Mörk

Reputation: 158409

Set the Alignment property to Left (or ListViewAlignment.Left if you do it in code).

Upvotes: 10

Related Questions