vb webbrowser控件如何屏蔽右键

2024-12-27 11:02:28
推荐回答(1个)
回答1:

'引用Microsoft HTML OBject Library
'加入webbrowser控件
'在窗体上自定义一个菜单(设为MyMenu)
'复制下面代码,运行即可禁止右键菜单了

'====窗体代码====
Dim WithEvents M_Dom As MSHTML.HTMLDocument
Private Function M_Dom_oncontextmenu() As Boolean
M_Dom_oncontextmenu = False
End Function
Private Sub Webbrowser1_DownloadComplete()
Set M_Dom = Webbrowser1.Document '好了,右键菜单没有了
me.PopupMenu mymenu '弹出自定义菜单
End Sub