Click here to Skip to main content
Rate this: bad
good
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 12-Jun-12 0:42am
Comments
RDBurmon at 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
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
v3
Comments
shahin web at 12-Jun-12 6:05am
   
thanks reza, i read all off them before.
Reza Ahmadi at 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 at 12-Jun-12 6:23am
   
migam aga reza man kheili taze varedam emkan dare shoma yekam komak konid.kheili mamnun
Reza Ahmadi at 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 at 12-Jun-12 6:50am
   
kheili mamnun.
Reza Ahmadi at 12-Jun-12 7:01am
   
Khahesh
Rate this: bad
good
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;
</SCRIPT>
 
More details Click this Link
 
http://www.angelfire.com/fl5/html-tutorial/rclick.htm[^]
  Permalink  
Comments
shahin web at 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 at 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

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

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,142
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 13 Jun 2012
Copyright © CodeProject, 1999-2014
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