| | |
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 21 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; 21 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 alignment app array barchart bitmap box broadcast c# c#gridviewcolumn cast check checkbox client combobox communication control conversion csharp custom database datagrid datagridview dataset datatable datetime degrees development draganddrop drawing elevated encryption enum excel file focus form format forms function gdi+ hospitalmanagementsystem httpwebrequest image index input install java label list listbox localization login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml






