Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. List box VScroll

List box VScroll

Scheduled Pinned Locked Moved C#
help
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    crazymubashir
    wrote on last edited by
    #1

    :(( 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.

    E 1 Reply Last reply
    0
    • C crazymubashir

      :(( 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.

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      How are you creating your custom listbox? Are you designing it from scratch or inheriting from the existing listbox control? Ed

      C 1 Reply Last reply
      0
      • E Ed Poore

        How are you creating your custom listbox? Are you designing it from scratch or inheriting from the existing listbox control? Ed

        C Offline
        C Offline
        crazymubashir
        wrote on last edited by
        #3

        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.

        E 1 Reply Last reply
        0
        • C crazymubashir

          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.

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          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

          C 1 Reply Last reply
          0
          • E Ed Poore

            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

            C Offline
            C Offline
            crazymubashir
            wrote on last edited by
            #5

            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.

            E 1 Reply Last reply
            0
            • C crazymubashir

              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.

              E Offline
              E Offline
              Ed Poore
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups