Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. disable right click of mouse in windowsapplication in c#

disable right click of mouse in windowsapplication in c#

Scheduled Pinned Locked Moved C#
helpcsharp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prgramya
    wrote on last edited by
    #1

    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

    V 1 Reply Last reply
    0
    • P prgramya

      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

      V Offline
      V Offline
      vinSharp
      wrote on last edited by
      #2

      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:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups