Handling scroll event on listview in c# -


I have a list view that generates thumbnails using a background player when the list view is being scrolled I want to stop the background player and get the current value of the scrolled area, when the user stopped scrolling the list view, according to the value of the scrolled area, the background pattern starting from the item Start with blood.

Is it possible to handle the scroll event's scrolling event? If yes, how? If not, then what is the best option as described above?

You must add the list to support the view class so that you can be notified about scroll events. Add a new class to your project and paste the code below. Compile Drop new list view controls on your form from the toolbox. Apply a handler to the new scroll event.

  using the system; Using System.Windows.Forms; Category MyListView: List View {ScrollEventHandler Scroll Public Event}; Protected Virtual Zones onscroll (ScrollEventArgs e) {ScrollEventHandler Handler = this.Scroll; If (handler! = Null) handler (this, e); } Secure Override Zero WndProc (Ref message message) {base.WndProc (Ref M); If (m.msg == 0x115) {// Trap WM_VSCROLL onscroll (New scroll Avent ARGS (scroll type type) (M. WParam.ToInt32 () and 0xffff), 0)); }}}  

Keep in mind that ScrollEventArgs.NewValue is not meaningful, it depends on the number of items in the ListView. I forced it to 0. After your requirements, you want to look for the Scroll Avent type. Underscore notification prevents users from scrolling. And anything helps you to figure out that the user started scrolling. For example:

  ScrollEventType mLastScroll = ScrollEventType.EndScroll; Private Zero myListView1_Scroll (Object Sender, ScrollEventArgs E) {if (e.Type == ScrollEventType.EndScroll) scrollEnded (); And if (mLastScroll == ScrollEventType.EndScroll) scroll start (); MLastScroll = e.Type; }  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -