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. ListView and VScrollBar.

ListView and VScrollBar.

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 3 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.
  • 9 Offline
    9 Offline
    93Current
    wrote on last edited by
    #1

    Hi @all, I have a ListView and a VScrollBar (I need the Scroll event...) on it with ListView.Scrollable set to false, because the ListView's ScrollBar would be on top always, so that I could not access my VScrollBar. But my problem is: How can I access the ListViewItems that are not visible? I tried to call the EnsureVisible() method at the Scroll event . The result was: The VScrollBar scrolled but the ListViewItems that are not visble didn't scrolled into view. It seems to be that the EnsureVisible() method only take effect if ListView.Scrollable is set to true. It must be a simple work - it drives me crazy! Please help!

    C J 9 3 Replies Last reply
    0
    • 9 93Current

      Hi @all, I have a ListView and a VScrollBar (I need the Scroll event...) on it with ListView.Scrollable set to false, because the ListView's ScrollBar would be on top always, so that I could not access my VScrollBar. But my problem is: How can I access the ListViewItems that are not visible? I tried to call the EnsureVisible() method at the Scroll event . The result was: The VScrollBar scrolled but the ListViewItems that are not visble didn't scrolled into view. It seems to be that the EnsureVisible() method only take effect if ListView.Scrollable is set to true. It must be a simple work - it drives me crazy! Please help!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If you make your control not scrollable, it won't scroll. I doubt there is a simple way around this, it's doing what you asked it to. Christian Graus - Microsoft MVP - C++

      1 Reply Last reply
      0
      • 9 93Current

        Hi @all, I have a ListView and a VScrollBar (I need the Scroll event...) on it with ListView.Scrollable set to false, because the ListView's ScrollBar would be on top always, so that I could not access my VScrollBar. But my problem is: How can I access the ListViewItems that are not visible? I tried to call the EnsureVisible() method at the Scroll event . The result was: The VScrollBar scrolled but the ListViewItems that are not visble didn't scrolled into view. It seems to be that the EnsureVisible() method only take effect if ListView.Scrollable is set to true. It must be a simple work - it drives me crazy! Please help!

        J Offline
        J Offline
        Jano Petras
        wrote on last edited by
        #3

        It could be possible to modify control styles to get rid of the scroll bar - must be done through interop though (calling into Win32 API) and still have control thinking it is there (by setting scrollbar's visible to false or similar). I don't think it is too easy as I had a lot of hard time fidling around ListView - it has a lot of strange behaviours under .NET (did you know it is owner-drawn under .NET at all times?) Regards JP

        1 Reply Last reply
        0
        • 9 93Current

          Hi @all, I have a ListView and a VScrollBar (I need the Scroll event...) on it with ListView.Scrollable set to false, because the ListView's ScrollBar would be on top always, so that I could not access my VScrollBar. But my problem is: How can I access the ListViewItems that are not visible? I tried to call the EnsureVisible() method at the Scroll event . The result was: The VScrollBar scrolled but the ListViewItems that are not visble didn't scrolled into view. It seems to be that the EnsureVisible() method only take effect if ListView.Scrollable is set to true. It must be a simple work - it drives me crazy! Please help!

          9 Offline
          9 Offline
          93Current
          wrote on last edited by
          #4

          [DllImport("user32.dll")] static extern bool ShowScrollBar(IntPtr hWnd, int wBar, bool bShow); the call... ShowScrollBar(listView1.Handle, 1, false); ...works! Sebastian.

          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