我试过了 不行 我将代码放上来 看看是不是我哪里错了public class NewBrowser : WebBrowser { protected override void WndProc(ref Message m) { if (m.Msg == 0x200)//WM_MOUSEMOVE { return; } base.WndProc(ref m); } }
我通过给程序添加消息过滤器方法试图让WebBrowser收不到鼠标消息,也不起作用。楼主这样做是为了满足软件的什么功能?说一下好让我想想有没有其它变通方法。 static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.AddMessageFilter(new MyMessager()); Application.Run(new MailSender()); } } internal class MyMessager : IMessageFilter { const int WM_MOUSEMOVE = 0x0200; public bool PreFilterMessage(ref Message m) { switch (m.Msg) { case WM_MOUSEMOVE: return true; default: return false;
貌似和我近段写的一个程序类似,但我采用的方法是“抓图”,webbrowser在超出窗体的位置运行,在webrowser载入页面完成后,抓图给pictureBox控件进行显示,而调用windows API PostMessage发送点击给webbrowser内网页仍然是有效的,同时pictureBox可以进行页面显示的缩放。
{
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x200)//WM_MOUSEMOVE
{
return;
} base.WndProc(ref m);
}
}
我通过给程序添加消息过滤器方法试图让WebBrowser收不到鼠标消息,也不起作用。楼主这样做是为了满足软件的什么功能?说一下好让我想想有没有其它变通方法。
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.AddMessageFilter(new MyMessager());
Application.Run(new MailSender());
}
} internal class MyMessager : IMessageFilter
{
const int WM_MOUSEMOVE = 0x0200; public bool PreFilterMessage(ref Message m)
{
switch (m.Msg)
{
case WM_MOUSEMOVE:
return true;
default:
return false;
}
}
}//end class