disable right click of mouse in windowsapplication in c#
-
I'm working on an app that's using the WebBrowser control in a c# windows application. I got the control working fine, hooking to the document object. But I've run into a major issue with hooking the Document events. Whenever I hook any of the HTMLDocumnetEvent2_Event events like this: HTMLDocumentEvents2_Event DocEvents = this.Browser.Document as HTMLDocumentEvents2_Event ; DocEvents.oncontextmenu += new HTMLDocumentEvents2_oncontextmenuEventHandler(Browser_ContextMenu); the browser document becomes unresposinve.All mouse clicks are eaten. I cannot click on any text box or any link . But the right click is disabled . Can anyone help to solve this problem such that i can disable the right click in the browser control and browser document and mouse clicks also work fine in c# windows application. thanks ramya -- modified at 23:34 Monday 27th February, 2006
-
I'm working on an app that's using the WebBrowser control in a c# windows application. I got the control working fine, hooking to the document object. But I've run into a major issue with hooking the Document events. Whenever I hook any of the HTMLDocumnetEvent2_Event events like this: HTMLDocumentEvents2_Event DocEvents = this.Browser.Document as HTMLDocumentEvents2_Event ; DocEvents.oncontextmenu += new HTMLDocumentEvents2_oncontextmenuEventHandler(Browser_ContextMenu); the browser document becomes unresposinve.All mouse clicks are eaten. I cannot click on any text box or any link . But the right click is disabled . Can anyone help to solve this problem such that i can disable the right click in the browser control and browser document and mouse clicks also work fine in c# windows application. thanks ramya -- modified at 23:34 Monday 27th February, 2006
Hi Ramya, The System.Windows.Forms.WebBrowser control has a public property IsWebBrowserContextMenuEnabled. Set this boolean to FALSE, so the Context menu would not be displayed. BTW, just as a passing reference, do remember that context menu can also be displayed using the keyboard. So setting this property of webbrowser would take care of both the 'Keyboard' and 'Mouse - Right click' related ways of displaying the context menu. Regards, vinSharp There are two kinds of fools in this world: One who give advice and the others who do not take it...:laugh: