You can create your own link shortcut class that extends LinkLabel and overrides the OnKeyUp or OnKeyDown event to capture the ENTER key press.
This will allow you to reproduce the code for each link label added to your form.
eg.
public class LinkLabelEx : LinkLabel
{
protected override void OnKeyUp(KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
e.SuppressKeyPress = true;
e.Handled = true;
OnLinkClicked(new LinkLabelLinkClickedEventArgs(new Link(0, this.Text.Length)));
}
else
{
base.OnKeyUp(e);
}
}
}
source
share