可以用GetScrollPos得到。
public class MyRichTextBox: RichTextBox
{
[DllImport("user32")]
private static extern int GetScrollPos(IntPtr hWnd, Int32 nBar); private const Int32 WM_VSCROLL = 0x00000115;
private const Int32 SB_VERT = 0x00000001; public delegate void ScrollEventHandler(object sender, Int32 position);
public event ScrollEventHandler VScroll;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_VSCROLL)
{
int position = GetScrollPos(m.HWnd, SB_VERT);
VScroll(this, position);
} base.WndProc(ref m);
}
}
public class MyRichTextBox: RichTextBox
{
[DllImport("user32")]
private static extern int GetScrollPos(IntPtr hWnd, Int32 nBar); private const Int32 WM_VSCROLL = 0x00000115;
private const Int32 SB_VERT = 0x00000001; public delegate void ScrollEventHandler(object sender, Int32 position);
public event ScrollEventHandler VScroll;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_VSCROLL)
{
int position = GetScrollPos(m.HWnd, SB_VERT);
VScroll(this, position);
} base.WndProc(ref m);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货