I have a LinkLabel
to which a context menu strip is attached. This context menu has 2 options: 'Copy hyperlink' or 'Open hyperlink'. There is no problem when there is only one link in the link label. But I can't figure out how you can (if you can) know which link out of the Links
property in the link label is right clicked. This is what I have that works for a single link:
private void contextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
ContextMenuStrip item = sender as ContextMenuStrip;
LinkLabel tempLink = item.SourceControl as LinkLabel;
if (e.ClickedItem.Text == "&Open Hyperlink")
{
System.Diagnostics.Process.Start(tempLink.Links[0].LinkData.ToString());
}
else
{
System.Windows.Forms.Clipboard.SetText(tempLink.Links[0].LinkData.ToString());
}
}
Some help on how to know which of the Links
is clicked would be welcome.
Use click event and type folloing code LinkLabel llb = (LinkLabel)sender; now llb.Text has text on which u click the linklabel.