axwebbrowser编辑模式下按F5的问题

stanly20000 2006-04-19 05:13:23
我用axwebbrowser。并且设置body的contenteditable=true.也就是可以编辑了。但是在编辑的过程中如果按下F5键就退出编辑模式,一片空白了。
或是,contenteditable=false,然后我设置innerhtml=...,但是当点右键,选择“刷新”后。也是一篇空白。
该怎样阻止刷新的操作呢?右键还好说一点,我可以换个右键。但是F5就不行了,我处理它的keydown事件好像也无济于事啊。
...全文
144 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
warren1999 2006-04-21
  • 打赏
  • 举报
回复
mark
stanly20000 2006-04-20
  • 打赏
  • 举报
回复
用更简单的方法搞定了。关键是我的Form中没有其他需要处理F5的地方。axwebbrowser这个控件麻烦的地方就在于处理了keydown之类的事件,其实Form没有收到。
public class MyMainForm : System.Windows.Forms.Form, IMessageFilter

{

const int WM_KEYDOWN = 0x100;


public bool PreFilterMessage(ref Message m)

{

Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;

if(m.Msg == WM_KEYDOWN && keyCode == Keys.F5)

{

return true;

}

return false;

}

....

....

....

private void MyMainForm_Load(object sender, System.EventArgs e)

{

Application.AddMessageFilter(this);

}

}

蒋晟 2006-04-19
  • 打赏
  • 举报
回复
There is an articlr about this

http://www.codeproject.com/internet/detecting_the_ie_refresh.asp

However, it is a doc error that each DWebBrowserEvents2::DownloadBegin event will
have a corresponding DWebBrowserEvents2::DownloadComplete event. The behavior is actually that when you get a DWebBrowserEvents2::DownloadComplete event, it applies to all of the DWebBrowserEvents2::DownloadBegin events you got since the last DWebBrowserEvents2::DownloadComplete. The intent of these two events is for "something is happening" UI to be started and stopped - they're not good for much else.


110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧