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); }
void InternalUpdateScrollBars(bool vRedraw, bool hRedraw, bool redrawNow) { if (this.IsHandleCreated && Visible) { HandleRef handle = new HandleRef(this, this.Handle); Native.SCROLLINFO v = new Native.SCROLLINFO(); v.cbSize = Marshal.SizeOf(typeof(Native.SCROLLINFO)); v.fMask = Native.SIF.ALL; v.nMin = 0; v.nMax = scrollBarsInfo.scrollSize.Height; v.nPage = ClientRectangle.Height; v.nPos = scrollBarsInfo.scrollPos.Y; v.nTrackPos = 0; Native.SetScrollInfo(handle, Native.SB.VERT, ref v, redrawNow && vRedraw); Native.SCROLLINFO h = new Native.SCROLLINFO(); h.cbSize = Marshal.SizeOf(typeof(Native.SCROLLINFO)); h.fMask = Native.SIF.ALL; h.nMin = 0; h.nMax = scrollBarsInfo.scrollSize.Width; h.nPage = ClientRectangle.Width; h.nPos = scrollBarsInfo.scrollPos.X; h.nTrackPos = 0; Native.SetScrollInfo(handle, Native.SB.HORZ, ref h, redrawNow && hRedraw); if (!redrawNow) { scrollBarsInfo.vRedraw |= vRedraw; scrollBarsInfo.hRedraw |= hRedraw; if (!scrollBarsInfo.repaintPosted) { Native.PostMessage(handle, ScrollBarsInfo.WM_REPAINTSCROLLBARS, IntPtr.Zero, IntPtr.Zero); scrollBarsInfo.repaintPosted = true; } } } }