Disable horizontal scrollbar in listview control

Hi,

I want to disable horizontal scrollbar in Listview (view: Details).
Also i want to keep vertical scrollbar.

Thank you
corpse114Asked:
Who is Participating?
 
dbrckoviCommented:
You can hide the scrollbar at will using code below, but unfortunatelly it will become visible as soon as control repaints it self.

.
using System.Runtime.InteropServices;
.
.
public partial class ....
{
   [DllImport ("user32")]
    private static extern long ShowScrollBar (long hwnd , long wBar, long bShow);
    long SB_HORZ = 0;
    long SB_VERT = 1;
    long SB_BOTH = 3;
   
    private void HideHorizontalScrollBar ()
    {
        ShowScrollBar(listView1.Handle.ToInt64(), SB_HORZ, 0);
    }
}

Open in new window

0
 
clinton_cunninghamCommented:
Change the ListView View property to LargeIcon - this would prevent the horizontal scroll bar from appearing.
0
 
dbrckoviCommented:
Hi!

Horizontal scrollbar in listview is only visible if columns are wider than control's client area.
You can either reduce the size of your columns or increase width of the whole control.


0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
corpse114Author Commented:
It worked perfectly. Thank you :)
0
 
dbrckoviCommented:
You're welcome!
0
 
Lucien AssaillitCommented:
Thank you !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.