i need your help to create a right click option in webbrowser control i have.
may be if i right click in a link will open this option :
open in new tab
open in new window
copy link
please help me create a the C# code and the explaination, because i am a newbie in webbrowser control.
i need your help to create a right click option in webbrowser control i
Share
It’s pretty easy to create your own context menu using Visual studio. Just drop a context menu item onto your form, and boom, your almost done.
Add the buttons you want, handle their click/changed events as necessary.
Then, in your code, either use the properties on the webBrowser control to change the context menu to the one you created, or handle it in code on Form_Load.
Where browserCMenu would be created inside of the designer, but you could create from code as well:
Note that the above is designer generated code. As you’ll be (most likely) using the Visual Studio designer to do your work you can just do the following steps:
You can also query what type of text is being targeted as well, but i wont go into that here, you can search MSDN for that information, or search here on StackOverflow, there are several articles on that. But that will allow you to obtain different context menus for different types of data being right clicked (i dont find it that useful personally). It’s best just to present a standard context menu for all browser controls, that use the same context menu items, so that your code isn’t bogged down/too complex with too many context menus.