Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Identify Mouse Button Clicks on controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James - 11 Jul 2006 09:58 GMT
hi all

when we click on Control, Both Left as well as Right Mouse Button Click
gives the same functionality. Is there any solution to filter that
only Left mouse clicks allowed. Actually I have more than one clikable
controls on my UserControl giving the same functionality.
Any better ideas than to capture individual Mouse events of every
contained control.

Thanx in advance
James
SMJT - 11 Jul 2006 12:05 GMT
You could just check which mouse button was pressed

 protected override void OnMouseClick(MouseEventArgs e)
       {
           base.OnMouseClick(e);

           if (e.Button == MouseButtons.Left)
               MessageBox.Show("Pushed left button");

           if (e.Button == MouseButtons.Right )
               MessageBox.Show("Pushed right button");
       }
It's a bit basic but should do the trick.
SMJT
> hi all
>
[quoted text clipped - 7 lines]
> Thanx in advance
> James
James - 11 Jul 2006 13:15 GMT
hello dear,
    I had made a usercontrol containing No. of  clickable child
controls.
    thanks for your Help.
    But Overriding OnMouseDown event in my User control would catch
only Mouse        clicks on thus parent control not on child controls.
I also want to check if any Child control is clicked and which User has
preesed which Button ( Left or right). But doing this way , I have to
handle  Mouse event  on each child controls also which is in efficient.
any Better Ideas you have, can solve my problem.

Thanks
James

> You could just check which mouse button was pressed
>
[quoted text clipped - 21 lines]
> > Thanx in advance
> > James

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.