ExtListView.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections;
  3. using System.Reflection;
  4. using System.Windows.Forms;
  5. namespace FastReport.Controls
  6. {
  7. internal sealed class ExtListView : ListView
  8. {
  9. public event EventHandler FetchMoreItems;
  10. public ExtListView()
  11. {
  12. var pi = this.Controls.GetType().GetProperty("ImplicitControls", BindingFlags.NonPublic | BindingFlags.Instance);
  13. if (pi != null)
  14. {
  15. var arrayList = pi.GetValue(this.Controls) as ArrayList;
  16. if (arrayList != null)
  17. {
  18. foreach (var item in arrayList)
  19. {
  20. if (item is VScrollBar sc)
  21. {
  22. sc.ValueChanged += (s, e) =>
  23. {
  24. if (sc.Maximum - sc.LargeChange <= sc.Value)
  25. {
  26. FetchMoreItems?.Invoke(this, e);
  27. }
  28. };
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }
  35. }