944,123 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 1279
  • C# RSS
Nov 4th, 2009
0

Mouse Events Handling

Expand Post »
Quote ...
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...
Similar Threads
Reputation Points: 8
Solved Threads: 1
Newbie Poster
bk_bhupendra is offline Offline
22 posts
since Oct 2009
Nov 4th, 2009
0
Re: Mouse Events Handling
Could you send in the code you already have?
Reputation Points: 2035
Solved Threads: 645
Senior Poster
ddanbe is offline Offline
3,740 posts
since Oct 2008
Nov 4th, 2009
0

these r d codes

Deginer code(delegate)
C# Syntax (Toggle Plain Text)
  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
C# Syntax (Toggle Plain Text)
  1. private void simpleButton1_MouseHOver(object sender, System.Windows.Forms.MouseEventArgs e)
  2. {
  3. simpleButton1.BackColor = System.Drawing.Color.Black;
  4.  
  5. }
Reputation Points: 8
Solved Threads: 1
Newbie Poster
bk_bhupendra is offline Offline
22 posts
since Oct 2009
Nov 4th, 2009
0
Re: Mouse Events Handling
You are adding a MosueHover event to the form. Try:
C# Syntax (Toggle Plain Text)
  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; Nov 4th, 2009 at 12:52 pm.
Reputation Points: 512
Solved Threads: 246
Nearly a Posting Virtuoso
Ryshad is offline Offline
1,260 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: OO Quandary
Next Thread in C# Forum Timeline: error with stream





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC