• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5544
  • Last Modified:

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
0
corpse114
Asked:
corpse114
1 Solution
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
corpse114Author Commented:
It worked perfectly. Thank you :)
0
 
dbrckoviCommented:
You're welcome!
0
 
Lucien AssaillitCommented:
Thank you !
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now