How to get/set scrollbar positions in ListView?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Frank Rizzo (none_at_none.com)
Date: 05/21/04


Date: Fri, 21 May 2004 11:35:49 -0700

I reload the items in the listview on a regular schedule (i.e. clear the
listview, then load it up with fresh values).

I want add a convinience to the user whereby my application remembers
the position of the scrollbars after reloading the data. But I can’t
figure out how to retrieve the scrollbar position (both horizontal and
vertical). Neither can I figure out how to restore the state of the
scrollbars. I could theoretically figure out the first visible item
via the .TopItem property and run .EnsureVisible on it, however, I’d
still want to set the Horizontal scrollbar and I don’t know how to do this.

Any idea on how to do this?

Thanks,
Frank



Relevant Pages

  • Re: How to get/set scrollbar positions in ListView?
    ... >I reload the items in the listview on a regular schedule (i.e. clear the ... >listview, then load it up with fresh values). ... > Neither can I figure out how to restore the state of the scrollbars. ... > Horizontal scrollbar and I don't know how to do this. ...
    (microsoft.public.dotnet.languages.vb)
  • Custom colored scrollbars in ListView
    ... In an attempt to apply custom colors to the scrollbars inside a listview, ... have come across the FlatSB_* set of functions. ... I made sure I am using the Common Controls 5. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Extreme flicker in ListView when VirtualMode enabled
    ... the question is why is the whole ListView ... redrawn everytime VirtualListSize is changed? ... Redrawing the scrollbars would ... >> If VirtualMode is enabled in ListView, every time the VirtualListSize ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: ListView Scrollbars question
    ... I'm using the standard ListView control of VS 2003. ... ListView with 20 items at first, and then add items as the user scrolls. ... Tomas ...
    (microsoft.public.dotnet.languages.csharp)
  • Use of LockWindowUpdate() causes whole screen flicker
    ... // clear and reload a listview ... The intention is to avoid flickering and unnecessary redraws while reloading ... listview and only once, everyapplication seems to be redrawn ...
    (microsoft.public.vc.language)