In WinForm, there is a control that can display the contents of the HTML, which is WebBrowser, setting its Documentext property to the contents of the HTML.
When using WebBrowser to do the UI, we sometimes do not want the link inside the user click, more do not want to pop up annoying script error prompt box, do not want users to point out the right-click IE menu, to do these, in fact, are very easy to ...
Set WebBrowser
Webbrowser1.scripterrorssuppressed = true; Disable error scripting Tips
webbrowser1.iswebbrowsercontextmenuenabled = false; Disabling the right-click menu
webbrowser1.webbrowsershortcutsenabled = false; Disable shortcut keys
Webbrowser1.allowwebbrowserdrop = false;//No drag
webbrowser1.scrollbarsenabled = false;//Forbidden scroll bar
Disable error scripting Tip : Set the scripterrorssuppressed of the WebBrowser control to True
Disable the right-click menu : Set WebBrowser iswebbrowsercontextmenuenabled to False
Disable shortcut keys: Set WebBrowser's webbrowsershortcutsenabled to False
Disable Hyperlinks : There are two kinds of hyperlinks, one is the current window direct, one is open in a new window
Of course the window turns directly: Set the allownavigation of WebBrowser to False
Disable new window open, need to handle WebBrowser NewWindow event
private void Webbrowser1_newwindow (object sender, CancelEventArgs e)
{
E.cancel = true;
}
Finish the work above, the basic is finished, and the last point to note, that is drag-and-drop . Remember to set WebBrowser AllowWebBrowserDrop as false