Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
3.00/5 (1 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
Comments
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.

Try this Script

XML
<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;
</SCRIPT>


More details Click this Link

http://www.angelfire.com/fl5/html-tutorial/rclick.htm[^]
 
Share this answer
 
Comments
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,

thanks
Michael_Jacsi 13-Jun-12 4:23am    
S i understand ! try this below link its may helps to you
http://www.codeguru.com/csharp/csharp/cs_graphics/mouse/article.php/c6133/Detecting-Mouse-Button-Events-in-C.htm
hi,
webbrowser does not have a click event. In order to learn about that you can take a look at this article:

http://www.dotnetperls.com/webbrowser[^]

http://www.c-sharpcorner.com/uploadfile/mahesh/webbrowser-control-in-C-Sharp-and-windows-forms/[^]

Using the WebBrowser control in .NET[^]

I hope it helps,
Cheers
 
Share this answer
 
v3
Comments
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.

Cheers
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.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900