Click here to Skip to main content
13,096,858 members (84,389 online)
Rate this:
Please Sign up or sign in to vote.
hi guys
im new in c# programing and tring to make an app.
here is my question.
how to detect user left clicked in webbrowser control and show massege to user.

thanks and sorry about my bad english.
Posted 11-Jun-12 23:42pm
RDBurmon 13-Jun-12 9:28am
Thanks Everyone who replied to this thread , So Shahin, I think you have got enough responses and you should be able to mark it as your answer and close the thread. Please do so.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try this Script

<SCRIPT language="JavaScript">
    var message = "function disabled";
    function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){   alert(message); return false; }
    if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {  alert(message);     return false; } }
    document.onmousedown = rtclickcheck;

More details Click this Link[^]
shahin web 12-Jun-12 5:57am
thanks for answer, idont want js in html block right click.
im looking in C# to detect user mouse LEFT click and show message box. in c# webbrowser,

Michael_Jacsi 13-Jun-12 4:23am
S i understand ! try this below link its may helps to you
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

webbrowser does not have a click event. In order to learn about that you can take a look at this article:[^][^]

Using the WebBrowser control in .NET[^]

I hope it helps,
shahin web 12-Jun-12 6:05am
thanks reza, i read all off them before.
Reza Ahmadi 12-Jun-12 6:10am
If you are sure you need an on-click event on that control, you must create a new class, inherit from WebBrowser and then define an extra event, On-Click, in the new class. Then, you can use your new custom control to handle onclick event handler.

shahin web 12-Jun-12 6:23am
migam aga reza man kheili taze varedam emkan dare shoma yekam komak konid.kheili mamnun
Reza Ahmadi 12-Jun-12 6:38am
bebin man nemidonam chera mikhi emkane click bezari baraye in control. Vali age mosseri, ye class jadid besaz ke az WebBrowser ers bebare, ye event jadid ham toosh bezar. In classo bayad to ye projeye Class Library gharar bedi. bad az Dll toolid shode estefade koni ta betoni controle jadidi ke sakhti(ba oon classe jadidet sakhtish) rooye form hat estefade koni.
Age kam C# kar kardi bayad aval dar morede "How to define a new event in a class" ya moshabehe in estefade koni ta befahmi che jori mishe ye event be ye class ezafe kard.
vali bazam pishnahade man be shoma ine ke varede in kar nashi va avval Webbrowser ro be khobi yad begiri, niazmandito dobare besanji, va age didi bazam lazeme beri soraghe kari ke bala goftam.

moafagh bashi
Reza Ahmadi
shahin web 12-Jun-12 6:50am
kheili mamnun.
Reza Ahmadi 12-Jun-12 7:01am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 13 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100