Since vs2005, The webbrowser control provided by vs has been quite friendly and highly controllable.
Winform works with webbrowser for UI development, which is also a very smooth mode. Microsoft vs ide series InstallationProgram, Basically in this mode
When using webbrowser for UI, we sometimes do not wantLinkClick by users, but do not wantAn annoying Script Error prompt box is displayed.And do not want usersRight-click the IE menu,To do this, it is actually very easy...
Error script disabling prompt
Set
Scripterrorssuppressed Set to true
Disable right-click menu
Set
Iswebbrowsercontextmenuenabled Set to false
Disable shortcuts
Set
Webbrowsershortcutsenabled Set to false
Disable hyperlink
There are two types of hyperlinks:Direct switch of current window, One isOpen in new window
Of course, direct window redirection:
Set
Allownavigation Set to false
Open in new window:
To disable the opening of a new window, you must handle the newwindow event of webbrowser.
Private VoidWebbrowser1_newwindow (ObjectSender, canceleventargs e) {e. Cancel =True;}
After the above work is done, it is basically finished. The last point should be noted, that is, drag-and-drop.
Remember
Allowwebbrowserdrop Set to false
Success! Just enjoy it !!