public void OnScroll(MyScrollEventArgs e) { if (Scroll != null) { Scroll(this, e); } }
protected override void WndProc(ref Message m) { /* if(m.Msg==WM_PAINT) { SCROLLBARINFO psbi = new SCROLLBARINFO(); psbi.cbSize = Marshal.SizeOf(psbi); int nResult = GetScrollBarInfo(this.Handle, OBJID_VSCROLL, ref psbi); //"this" is a scrollbar if (nResult == 0) { int nLatError = Marshal.GetLastWin32Error(); // in kernel32.dll } Console.WriteLine(psbi.xyThumbTop.ToString()); if(fCheck&&psbi.xyThumbTop!=oldval) { fCheck=false; MessageBox.Show("WM_VSCROLL for select item"); } else if(psbi.xyThumbTop==oldval) { fCheck=false; } }*/ if(m.Msg==WM_VSCROLL) { Console.WriteLine("{0} {1} {2}", ((int)m.WParam >> 16), (Int16)m.WParam, m.LParam); MyScrollEventArgs ma = new MyScrollEventArgs(); ma.Orientation = ScrollOrientation.VerticalScroll; ma.WParam = m.WParam; OnScroll(ma); } base.WndProc (ref m); }