Native.SCROLLINFO GetScrollInfo(Native.SB sb) { Native.SCROLLINFO si = new Native.SCROLLINFO(); si.cbSize = Marshal.SizeOf(typeof(Native.SCROLLINFO)); si.fMask = Native.SIF.ALL; Native.GetScrollInfo(new HandleRef(this, base.Handle), sb, ref si); return(si); }
WmScrollResult DoWmScroll(ref System.Windows.Forms.Message m, int num, int maximum, Native.SB bar) { var ret = new WmScrollResult(); if (m.LParam != IntPtr.Zero) { ret.absoluteScrollPos = num; base.WndProc(ref m); return(ret); } else { int smallChange = 50; int largeChange = 200; ret.isScrollEvent = true; Native.SB sbEvt = (Native.SB)Native.LOWORD(m.WParam); switch (sbEvt) { case Native.SB.LINEUP: num += (ret.delta = -smallChange); if (num <= 0) { num = 0; } break; case Native.SB.LINEDOWN: num += (ret.delta = smallChange); if (num >= maximum) { num = maximum; } break; case Native.SB.PAGEUP: num += (ret.delta = -largeChange); if (num <= 0) { num = 0; } break; case Native.SB.PAGEDOWN: num += (ret.delta = largeChange); if (num >= maximum) { num = maximum; } break; case Native.SB.THUMBTRACK: num = this.GetScrollInfo(bar).nTrackPos; ret.isRealtimeScroll = true; break; case Native.SB.THUMBPOSITION: num = this.GetScrollInfo(bar).nTrackPos; break; case Native.SB.TOP: num = 0; break; case Native.SB.BOTTOM: num = maximum; break; case Native.SB.ENDSCROLL: scrollBarsInfo.userIsScrolling = false; ret.isScrollEvent = false; break; } ret.absoluteScrollPos = num; return(ret); } }