日期:2014-05-18 浏览次数:21251 次
private void Form_Preview_Load(object sender, EventArgs e) { //加载PDF this.axAcroPDF.LoadFile(pdfPath); } #region 上下移动按钮 [DllImport("user32.dll")] static extern void mouse_event(int flags, int dX, int dY, int buttons, int extraInfo); const int MOUSEEVENTF_WHEEL = 0x800; /// <summary> /// 上移 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrivous_Click(object sender, EventArgs e) { this.axAcroPDF.Focus(); mouse_event(MOUSEEVENTF_WHEEL, 0, 0, 300, 0); } /// <summary> /// 下移 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnNext_Click(object sender, EventArgs e) { this.axAcroPDF.Focus(); mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -300, 0); } #endregion
[DllImport("user32.dll")] static extern int SendMessage(IntPtr hwnd,int msg,int lp,IntPtr rp); SendMessage(richTextBox1.Handle, 0x115, 7, IntPtr.Zero);
------解决方案--------------------
这个我看行
------解决方案--------------------
SENDMESSAGE和POSTMESSAGE试试。。。。我用MOUSE_EVENT做的时候也不给力的说!
基本上就这几个玩意轮着来,总有一个适合你的!
------解决方案--------------------
上面那个通过修改第三个参数可以实现步进,后退,顶部,底部,下面有个精确控制移动到哪个位置的,比如移动到位置200
[DllImport("user32.dll")] static extern int SetScrollPos(IntPtr hwnd, int bar, int position, int redraw); SetScrollPos(richTextBox1.Handle, 1, 200, 1);
------解决方案--------------------
把 mouse_event(MOUSEEVENTF_WHEEL, 0, 0, 300, 0); 写两遍,如下 mouse_event(MOUSEEVENTF_WHEEL, 0, 0, 300, 0); mouse_event(MOUSEEVENTF_WHEEL, 0, 0, 300, 0); 我也不知道为什么要这样,反正我知道这样能行