You can use the MouseEnter
and MouseLeave
events of your label to modify the Font
used
private void OnMouseEnter(object sender, EventArgs e)
{
label1.Font = new Font(label1.Font.Name, label1.Font.SizeInPoints, FontStyle.Underline);
}
private void OnMouseLeave(object sender, EventArgs e)
{
label1.Font = new Font(label1.Font.Name, label1.Font.SizeInPoints, FontStyle.Regular);
}
If you do not need to modify the font name or size you can directly use new Font(label1.Font, FontStyle.Underline)
Also, if you need to add multiple styles, you can use the |
operator :
label1.Font = new Font(label1.Font.Name, label1.Font.SizeInPoints, FontStyle.Underline | FontStyle.Bold);