List box VScroll
-
:(( Hi, I am trying to build my custom listbox control. The problem i am having is that, if my list box shows 10 items and i have for suppose 20 items in it. now when a user scroll down using lstBox 'VScroll' control then my application doesn't know that the user has scroll down. Any Suggession without using "Selected IndexChange " or "Click Event" or "Key Down" Events.
-
:(( Hi, I am trying to build my custom listbox control. The problem i am having is that, if my list box shows 10 items and i have for suppose 20 items in it. now when a user scroll down using lstBox 'VScroll' control then my application doesn't know that the user has scroll down. Any Suggession without using "Selected IndexChange " or "Click Event" or "Key Down" Events.
-
How are you creating your custom listbox? Are you designing it from scratch or inheriting from the existing listbox control? Ed
hi Ed, Sorry for the ambiguity in my question. Yes, I am inheriting from the listbox control. I am having the problem metioned earlier. Thanks for the reply.
-
hi Ed, Sorry for the ambiguity in my question. Yes, I am inheriting from the listbox control. I am having the problem metioned earlier. Thanks for the reply.
In that case can't you just override the
OnDrawItem
method?protected overrides void OnDrawItem(DrawItemEventArgs e)
{
// Do drawing stuff here
}If you need to resize each item based on their contents then you can override the
OnMeasureItem
method. This should automatically display the scroll bars as and when they're needed, you only need to take care of drawing one item at a time also. Ed -
In that case can't you just override the
OnDrawItem
method?protected overrides void OnDrawItem(DrawItemEventArgs e)
{
// Do drawing stuff here
}If you need to resize each item based on their contents then you can override the
OnMeasureItem
method. This should automatically display the scroll bars as and when they're needed, you only need to take care of drawing one item at a time also. Edhi Ed.Poore, I am posting this message just by reading yours, so plz hear out my problem in detail. I hope your suggestion works. Now problem i am having is when ever a user scroll down or up, some items also go up/down. Now i have to find out when user used the scroll bar of the list box, how far down/up he went. Then i can use the topIndex property to map my items as mapping is done in sql Server diagrams. I hope i did explained myself clearly. Thanks again.
-
hi Ed.Poore, I am posting this message just by reading yours, so plz hear out my problem in detail. I hope your suggestion works. Now problem i am having is when ever a user scroll down or up, some items also go up/down. Now i have to find out when user used the scroll bar of the list box, how far down/up he went. Then i can use the topIndex property to map my items as mapping is done in sql Server diagrams. I hope i did explained myself clearly. Thanks again.
Ah, I see it clearly now, you will have to trap some events for the scrolling. Looking through the documentation it might be easier to create a composite control which has a listbox, and a couple of buttons for going up and down a page. This would also be more intuitive if there is a delay in the loading. Ed