MrB3NiT0
MrB3NiT0

Reputation: 147

WinForms : vScrollBar for ListView

I want to bind a vScrollBar control to my listview because the default verticalScrollBar of my listview can't be wider. I don't know how to process to bind this two control and can scroll my listview with this vScrollBar. If someone has experimented the same things and have advice for me he is welcome.

What I'm trying to do is catch scroll event on vScrollBar to affect the position of my listview's scrollbar but it's not working :

private void VScrollBar1_Scroll(object sender, ScrollEventArgs e)
{            
     Point a = new Point(0, vScrollBar1.Value);
     listNotif.AutoScrollOffset = a;            
}

Upvotes: 0

Views: 684

Answers (1)

L_J
L_J

Reputation: 2439

You can use this to scroll ListView with custom vScrollBar:

private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
    listNotif.EnsureVisible(e.NewValue);
}

Upvotes: 1

Related Questions