Jet Seighart Jet Seighart - 1 year ago 118
C# Question

Focus Event on LinkLabel- C#

I'm new in c#. Is there a code. When I point the mouse pointer on a specific 'linklabel'. It will do some function. For example. When I point the mouse pointer on a specific linklabel. Its forecolor will change. But when I leave the mouse pointer it will back to normal. Can you give me a simple code for that? Thank You!

Answer Source

All Windows forms controls (including the LinkLabel control) has a MouseHover event and a MouseLeave event.

These can be used to perform actions when the mouse hovers over a LinkLabel.


//Name of the LinkLabel is linkLabel1

private void linkLabel1_MouseHover(object sender, EventArgs e)
    linkLabel1.LinkColor = Color.Red;

private void linkLabel1_MouseLeave(object sender, EventArgs e)
    linkLabel1.LinkColor = Color.Blue;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download