How to deactivate “right click” on WPF Webbrowser Control?

后端 未结 5 604
终归单人心
终归单人心 2020-12-01 09:41

I can\'t seem to find an answer to this. Does anyone know?

Thanks

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 10:06

    Reference mshtml

    using mshtml;
    

    Then you can do this by accessing the document:

    MainBrowser.Navigate("https://www.domain.com");
    
     MainBrowser.LoadCompleted += (o, args) =>
     {
        var doc = (HTMLDocumentEvents2_Event) MainBrowser.Document;
        doc.oncontextmenu += obj => false;
     };
    

提交回复
热议问题