| | |
Mouse Events Handling
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2009
Posts: 22
Reputation:
Solved Threads: 1
•
•
•
•
Deginer code(delegate)
EventC# Syntax (Toggle Plain Text)
// // simpleButton1 // this.simpleButton1.Location = new System.Drawing.Point(60, 55); this.simpleButton1.Name = "simpleButton1"; this.simpleButton1.Size = new System.Drawing.Size(100, 23); this.simpleButton1.TabIndex = 6; this.simpleButton1.Text = "Fagmann01"; this.simpleButton1.Visible = false; this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click); this.MouseHover += new System.Windows.Forms.MouseEventHandler(this.simpleButton1_MouseHOver);
C# Syntax (Toggle Plain Text)
private void simpleButton1_MouseHOver(object sender, System.Windows.Forms.MouseEventArgs e) { simpleButton1.BackColor = System.Drawing.Color.Black; }
0
#4 22 Days Ago
You are adding a MosueHover event to the form. Try:
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
C# Syntax (Toggle Plain Text)
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
"Learning is more than absorbing facts, it is acquiring understanding.” - William Arthur Ward
![]() |
Similar Threads
- Intercept windows mouse events (C++)
- Mouse Events (C++)
- How can I capture mouse events on a form's title bar (VB.NET)
- Object and Mouse events... (Java)
- Mouse Cursor Image (Java)
- Overriding mouse events (C#)
- Adding mouse listener to a frame (Java)
- Locking the mouse button down (C)
Other Threads in the C# Forum
- Previous Thread: OO Quandary
- Next Thread: error with stream
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql mysql.data.client operator path photoshop php picturebox pixelinversion post programming radians regex remoting resourcefile richtextbox server sleep socket sql statistics stream string study system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






