dimanche 4 mai 2014

Visual studio - comportement du changement de listbox scrollbars en c# - Stack Overflow


I have a winforms project with a large listbox. My aim is to change some of the functionality of the scrollbars of the list. Firstly, I am trying to navigate through the items in the list using the scrollbar. i.e. moving the scrollbar up and down changes which item is selected. I know programatically you can change the selected index by using


listbox1.SelectedIndex=*index*

My idea so far is to lock the scroll bar in one of 3 positions (UP/NEUTRAL/DOWN) to increment and decrement index. To do this i was thinking of disabling the vertical scrollbar (Hide vertical scroll bar in ListBox control) and use a custom one. Problem is i have so far been unable to find and information on how to link the new scrollbar to the list and/or change its behaviour. In fact i don't even know if it's possible to do.
Hoping to clarify: if the scrollbar is moved up, it changes focus to the previous item in the list. If it is moved down, it changes focus to the next item. Basically something similar to the iphone selection wheel.


Any ideas or suggestions on how i can make the scrollbar do this or any other object which could? Thank you.



I have a winforms project with a large listbox. My aim is to change some of the functionality of the scrollbars of the list. Firstly, I am trying to navigate through the items in the list using the scrollbar. i.e. moving the scrollbar up and down changes which item is selected. I know programatically you can change the selected index by using


listbox1.SelectedIndex=*index*

My idea so far is to lock the scroll bar in one of 3 positions (UP/NEUTRAL/DOWN) to increment and decrement index. To do this i was thinking of disabling the vertical scrollbar (Hide vertical scroll bar in ListBox control) and use a custom one. Problem is i have so far been unable to find and information on how to link the new scrollbar to the list and/or change its behaviour. In fact i don't even know if it's possible to do.
Hoping to clarify: if the scrollbar is moved up, it changes focus to the previous item in the list. If it is moved down, it changes focus to the next item. Basically something similar to the iphone selection wheel.


Any ideas or suggestions on how i can make the scrollbar do this or any other object which could? Thank you.


0 commentaires:

Enregistrer un commentaire