Mouse Events Handling

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 22
Reputation: bk_bhupendra is an unknown quantity at this point 
Solved Threads: 1
bk_bhupendra bk_bhupendra is offline Offline
Newbie Poster

Mouse Events Handling

 
0
  #1
22 Days Ago
How can i change the color or do smthing else when mouse pointer go over a button....

help with all mouse event handler

(i have tried some codes but errors)

[eg: Error 1 No overload for 'Form_Over' matches delegate 'System.EventHandler' ]

pls help...
thnx in advnc...
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,917
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso
 
0
  #2
22 Days Ago
Could you send in the code you already have?
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 22
Reputation: bk_bhupendra is an unknown quantity at this point 
Solved Threads: 1
bk_bhupendra bk_bhupendra is offline Offline
Newbie Poster

these r d codes

 
0
  #3
22 Days Ago
Originally Posted by bk_bhupendra View Post
Deginer code(delegate)
  1. //
  2. // simpleButton1
  3. //
  4. this.simpleButton1.Location = new System.Drawing.Point(60, 55);
  5. this.simpleButton1.Name = "simpleButton1";
  6. this.simpleButton1.Size = new System.Drawing.Size(100, 23);
  7. this.simpleButton1.TabIndex = 6;
  8. this.simpleButton1.Text = "Fagmann01";
  9. this.simpleButton1.Visible = false;
  10. this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
  11. this.MouseHover += new System.Windows.Forms.MouseEventHandler(this.simpleButton1_MouseHOver);
Event
  1. private void simpleButton1_MouseHOver(object sender, System.Windows.Forms.MouseEventArgs e)
  2. {
  3. simpleButton1.BackColor = System.Drawing.Color.Black;
  4.  
  5. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 331
Reputation: Ryshad has a spectacular aura about Ryshad has a spectacular aura about 
Solved Threads: 61
Ryshad's Avatar
Ryshad Ryshad is offline Offline
Posting Whiz
 
0
  #4
22 Days Ago
You are adding a MosueHover event to the form. Try:
  1. this.simpleButton1.MouseHover += new System.EventHandler(this.simpleButton1_MouseHover);

if you want to change the back colour when the mouse is over the button you would be better to look at MouseEnter and MouseLeave so that you can change the colour back when the mouse moves away.

Remember to mark this thread as solved if this has answered your question
Last edited by Ryshad; 22 Days Ago at 12:52 pm.
Please don't take for granted the work that solvers do for you. Take the time to fully understand the code they give you so that you might adapt it to future problems.

"Learning is more than absorbing facts, it is acquiring understanding.” - William Arthur Ward
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC