private static extern bool GetScrollInfo(IntPtr hWnd, int fnBar, ref SCROLLINFO info);
/// <summary> /// Intercept scroll messages to send notifications /// </summary> /// <param name="m">Message parameters</param> protected override void WndProc(ref Message m) { // Let the control process the message base.WndProc(ref m); // Was this a horizontal scroll message? if (m.Msg == WM_HSCROLL) { if (HorizontalScroll != null) { var wParam = (uint) m.WParam.ToInt32(); var si = new SCROLLINFO(); si.cbSize = Marshal.SizeOf(si); si.fMask = SIF_ALL; bool ret = GetScrollInfo(Handle, SB_HORZ, ref si); HorizontalScroll(this, new MozScrollEventArgs( GetEventType(wParam & 0xffff), (int) (wParam >> 16), si)); } } // or a vertical scroll message? else if (m.Msg == WM_VSCROLL) { if (VerticalScroll != null) { var wParam = (uint) m.WParam.ToInt32(); var si = new SCROLLINFO(); si.cbSize = Marshal.SizeOf(si); si.fMask = SIF_ALL; bool ret = GetScrollInfo(Handle, SB_VERT, ref si); VerticalScroll(this, new MozScrollEventArgs( GetEventType(wParam & 0xffff), (int) (wParam >> 16), si)); } } }
/// <summary> /// Initializes a new instance of the MozItemEventArgs class with default settings /// </summary> public MozScrollEventArgs(ScrollEventType type, int newValue, SCROLLINFO info) { m_type = type; m_newValue = newValue; m_info = info; }