imports System
imports System.Drawing
imports System.Windows.Forms
public class LinkLabelsGeneric : inherits Form
dim lnkMsft as LinkLabel
dim lnkLA as LinkLabel
public sub New()
Size = new Size(300,250)
' multiple links & generic handler
dim lnkMulti as LinkLabel = new LinkLabel()
lnkMulti.Parent = me
lnkMulti.Text = "AAAA AAAAA AA AAAAAAA"
lnkMulti.Location = new Point(0,75)
lnkMulti.AutoSize = true
lnkMulti.BorderStyle = BorderStyle.None
lnkMulti.LinkBehavior = LinkBehavior.HoverUnderline
lnkMulti.Links.Add(0,4,"www.java2java.com")
lnkMulti.Links.Add(6,5,"www.java2java.com")
lnkMulti.Links.Add(13,2, "www.java2java.com")
lnkMulti.Links.Add(17,7,"www.java2java.com")
AddHandler lnkMulti.LinkClicked, AddressOf lnkGeneric_LinkClicked
end sub
public shared sub Main()
Application.Run(new LinkLabelsGeneric())
end sub
private sub lnkGeneric_LinkClicked(ByVal sender as object, _
ByVal e as LinkLabelLinkClickedEventArgs)
dim lnk as LinkLabel = new LinkLabel()
lnk = CType(sender, LinkLabel)
lnk.Links(lnk.Links.IndexOf(e.Link)).Visited = true
Console.WriteLine(e.Link.LinkData.ToString())
'System.Diagnostics.Process.Start(e.Link.LinkData.ToString())
end sub
end class
|