我的Windows窗体中有一个Webbrowser,我希望它自动向下滚动页面。现在我这样做
this.webBrowser.Document.Window.ScrollTo(0, int.MaxValue);
但是当我启动我的应用程序时,webBrowser不会滚动。为什么?
这将工作!!)))
class KeyHandle
{
private static Int32 WM_KEYDOWN = 0x100;
private static Int32 WM_KEYUP = 0x101;
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
static extern bool PostMessage(IntPtr hWnd, int Msg, System.Windows.Forms.Keys wParam, int lParam);
public static void SendKey(IntPtr hWnd, System.Windows.Forms.Keys key)
{
PostMessage(hWnd, WM_KEYDOWN, key, 0);
}
}
调用方式:
KeyHandle.SendKey(this.webBrowser.Handle, Keys.PageDown);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句