void viewport_VScrollChanged(object sender, UIScrollEventArgs e) { if (VScrollChanged != null) { VScrollChanged.Invoke(sender, e); } }
/// <summary> /// The list's window procedure. /// </summary> /// <param name="m">A Windows Message Object.</param> protected override void WndProc(ref Message m) { if (m.Msg == LB_ADDSTRING || m.Msg == LB_INSERTSTRING || m.Msg == LB_DELETESTRING || m.Msg == LB_RESETCONTENT) { ItemsChanged?.Invoke(this, new EventArgs()); } // if the message indicates that the TopIndex property of the list box might have changed, raise the VScrollChanged event.. if (m.Msg == WM_VSCROLL || m.Msg == WM_MOUSEWHEEL || m.Msg == WM_KEYDOWN) { // ..if not denied and the TopIndex property was actually changed.. if (lastTopIndex != this.TopIndex) { lastTopIndex = TopIndex; // save the top index so it's changes can be monitored.. // if the VScrollChanged event is subscribed the raise the event with (FromControl = true).. VScrollChanged?.Invoke(this, new VScrollChangedEventArgs() { Minimum = 0, Maximum = Items.Count, Value = VScrollPosition, FromControl = true }); } } base.WndProc(ref m); }
public void RaiseProperEvents(UIScrollEventArgs hScrollEventArgs, UIScrollEventArgs vScrollEventArgs) { if (this.VScrollChanged != null && vScrollEventArgs != null) { VScrollChanged.Invoke(owner, vScrollEventArgs); } if (this.HScrollChanged != null && hScrollEventArgs != null) { HScrollChanged.Invoke(owner, hScrollEventArgs); } }
/// <summary> /// The WndProc is overridden so some messages can be used to raise the VScrollChanged event. /// </summary> /// <param name="m">A reference to a Message class instance.</param> protected override void WndProc(ref Message m) { base.WndProc(ref m); // first call the base WndProc.. // .. and if the message indicates that the TopIndex property of the list box might have changed, raise the VScrollChanged event.. if (m.Msg == WM_VSCROLL || m.Msg == WM_MOUSEWHEEL || m.Msg == WM_KEYDOWN) { // ..if not denied and the TopIndex property was actually changed.. if (!noEvent && lastTopIndex != this.TopIndex) { lastTopIndex = TopIndex; // save the top index so it's changes can be monitored.. // if the VScrollChanged event is subscribed the raise the event with (FromControl = true).. VScrollChanged?.Invoke(this, new VScrollChangedEventArgs() { Minimum = 0, Maximum = VScrollMaximum, Value = VScrollPosition, FromControl = true }); } } }