VB.Net by API/System.Windows.Forms/LinkLabel

Материал из VB Эксперт
Перейти к: навигация, поиск

LinkLabel.ActiveLinkColor

<source lang="vbnet">

Imports System.Windows.Forms Imports System.Drawing.Text Imports System.Drawing Imports System.Drawing.Drawing2D public class LinkLabelLinkData

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class Public Class Form1

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   End Sub
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       LinkLabel1.Text = "Home Page is www.microsoft.ru"
       LinkLabel1.Links.Add(13, 28, "http://www.microsoft.ru")
       LinkLabel1.LinkArea = New LinkArea(13, 28)
       LinkLabel1.LinkColor = Color.Red
       LinkLabel1.VisitedLinkColor = Color.Aqua
       LinkLabel1.ActiveLinkColor = Color.Pink
       LinkLabel1.Links(0).LinkData = "Register"
   End Sub
   Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
       Label1.Text = LinkLabel1.Text
   End Sub

End Class <Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Class Form1

   Inherits System.Windows.Forms.Form
   "Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing AndAlso components IsNot Nothing Then
           components.Dispose()
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
       Me.LinkLabel1 = New System.Windows.Forms.LinkLabel
       Me.Button1 = New System.Windows.Forms.Button
       Me.Label1 = New System.Windows.Forms.Label
       Me.SuspendLayout()
       "
       "LinkLabel1
       "
       Me.LinkLabel1.AutoSize = True
       Me.LinkLabel1.Location = New System.Drawing.Point(182, 51)
       Me.LinkLabel1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
       Me.LinkLabel1.Name = "LinkLabel1"
       Me.LinkLabel1.Size = New System.Drawing.Size(87, 15)
       Me.LinkLabel1.TabIndex = 0
       Me.LinkLabel1.TabStop = True
       Me.LinkLabel1.Text = "LinkLabel1"
       "
       "Button1
       "
       Me.Button1.Location = New System.Drawing.Point(185, 181)
       Me.Button1.Name = "Button1"
       Me.Button1.Size = New System.Drawing.Size(139, 28)
       Me.Button1.TabIndex = 1
       Me.Button1.Text = "Button1"
       Me.Button1.UseVisualStyleBackColor = True
       "
       "Label1
       "
       Me.Label1.AutoSize = True
       Me.Label1.Location = New System.Drawing.Point(64, 51)
       Me.Label1.Name = "Label1"
       Me.Label1.Size = New System.Drawing.Size(55, 15)
       Me.Label1.TabIndex = 2
       Me.Label1.Text = "Label1"
       "
       "Form1
       "
       Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
       Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
       Me.ClientSize = New System.Drawing.Size(547, 250)
       Me.Controls.Add(Me.Label1)
       Me.Controls.Add(Me.Button1)
       Me.Controls.Add(Me.LinkLabel1)
       Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
       Me.Name = "Form1"
       Me.Text = "Form1"
       Me.ResumeLayout(False)
       Me.PerformLayout()
   End Sub
   Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
   Friend WithEvents Button1 As System.Windows.Forms.Button
   Friend WithEvents Label1 As System.Windows.Forms.Label

End Class


 </source>


LinkLabel.BorderStyle

<source lang="vbnet"> imports System imports System.Drawing imports System.Windows.Forms public class LinkLabelsLinkArea : inherits Form

 dim lnkMsft as LinkLabel
 dim lnkLA as LinkLabel
 public sub New()
   Size = new Size(300,250)
   "  use Text property & LinkArea
   lnkMsft = new LinkLabel()
   lnkMsft.Parent = me
   lnkMsft.Text = "www.microsoft.ru"
   lnkMsft.Location = new Point(0,0)
   lnkMsft.AutoSize = true
   lnkMsft.BorderStyle = BorderStyle.None
   lnkMsft.LinkArea = new LinkArea(4,9)
   AddHandler lnkMsft.LinkClicked, AddressOf lnkMsft_LinkClicked
 end sub
 public shared sub Main() 
   Application.Run(new LinkLabelsLinkArea())
 end sub
 private sub lnkMsft_LinkClicked(ByVal sender as object,  ByVal e as LinkLabelLinkClickedEventArgs)
     lnkMsft.Links(lnkMsft.Links.IndexOf(e.Link)).Visited = true
      System.Diagnostics.Process.Start(lnkMsft.Text)
 end sub

end class


 </source>


LinkLabel.LinkArea

<source lang="vbnet"> imports System imports System.Drawing imports System.Windows.Forms public class LinkLabelsLinkArea : inherits Form

 dim lnkMsft as LinkLabel
 dim lnkLA as LinkLabel
 public sub New()
   Size = new Size(300,250)
   "  use Text property & LinkArea
   lnkMsft = new LinkLabel()
   lnkMsft.Parent = me
   lnkMsft.Text = "www.microsoft.ru"
   lnkMsft.Location = new Point(0,0)
   lnkMsft.AutoSize = true
   lnkMsft.BorderStyle = BorderStyle.None
   lnkMsft.LinkArea = new LinkArea(4,9)
   AddHandler lnkMsft.LinkClicked, AddressOf lnkMsft_LinkClicked
 end sub
 public shared sub Main() 
   Application.Run(new LinkLabelsLinkArea())
 end sub
 private sub lnkMsft_LinkClicked(ByVal sender as object,  ByVal e as LinkLabelLinkClickedEventArgs)
     lnkMsft.Links(lnkMsft.Links.IndexOf(e.Link)).Visited = true
      System.Diagnostics.Process.Start(lnkMsft.Text)
 end sub

end class


 </source>


LinkLabel.LinkClicked

<source lang="vbnet"> Imports System Imports System.Windows.Forms

Public Class MainClass

   Shared Sub Main()
       Dim form1 As Form = New Form1
       Application.Run(form1)
   End Sub

End Class Public Class Form1

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   Friend WithEvents lnkBuy As System.Windows.Forms.LinkLabel
   Friend WithEvents lnkWebSite As System.Windows.Forms.LinkLabel
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.lnkBuy = New System.Windows.Forms.LinkLabel()
       Me.lnkWebSite = New System.Windows.Forms.LinkLabel()
       Me.SuspendLayout()
       "
       "lnkBuy
       "
       Me.lnkBuy.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.lnkBuy.LinkArea = New System.Windows.Forms.LinkArea(0, 0)
       Me.lnkBuy.Location = New System.Drawing.Point(16, 60)
       Me.lnkBuy.Name = "lnkBuy"
       Me.lnkBuy.Size = New System.Drawing.Size(244, 48)
       Me.lnkBuy.TabIndex = 3
       Me.lnkBuy.Text = "www.vbex.ru"
       "
       "lnkWebSite
       "
       Me.lnkWebSite.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.lnkWebSite.LinkArea = New System.Windows.Forms.LinkArea(0, 0)
       Me.lnkWebSite.Location = New System.Drawing.Point(16, 16)
       Me.lnkWebSite.Name = "lnkWebSite"
       Me.lnkWebSite.Size = New System.Drawing.Size(248, 36)
       Me.lnkWebSite.TabIndex = 2
       Me.lnkWebSite.Text = "The whole line is a LinkLabel"
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(292, 150)
       Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lnkBuy, Me.lnkWebSite})
       Me.Name = "Form1"
       Me.Text = "Link Examples"
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub lnkBuy_LinkClicked(ByVal sender As Object, _
     ByVal e As LinkLabelLinkClickedEventArgs) Handles lnkBuy.LinkClicked, _
     lnkWebSite.LinkClicked
       e.Link.Visited = True
       System.Diagnostics.Process.Start(CType(e.Link.LinkData, String))
   End Sub
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       lnkBuy.Links.Add(0, 2, "http://www.vbex.ru")
       lnkBuy.Links.Add(6, 10, "http://www.vbex.ru")
       lnkWebSite.Links.Add(0, 10, "http://www.vbex.ru")
   End Sub

End Class


 </source>


LinkLabel.Link.LinkData

<source lang="vbnet"> Imports System Imports System.Data Imports System.Windows.Forms Imports System.Drawing Imports System.Diagnostics Public Class MainClass

   Shared Sub Main()
      Dim form1 As Form = New Form1
      Application.Run(form1)    
   End Sub

End Class

Public Class Form1

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       Dim new_link As System.Windows.Forms.LinkLabel.Link
       llblPangram.Links.Clear()
       new_link = llblPangram.Links.Add(16, 3)
       new_link.LinkData = "http://www.vbex.ru"
       new_link = llblPangram.Links.Add(40, 3)
       new_link.LinkData = "http://www.vbex.ru"
   End Sub
   " Display the URL associated with the clicked link.
   Private Sub llblPangram_LinkClicked(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) _
    Handles llblPangram.LinkClicked
       System.Diagnostics.Process.Start(e.Link.LinkData.ToString)
   End Sub

End Class

<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Public Class Form1

   Inherits System.Windows.Forms.Form
   "Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing AndAlso components IsNot Nothing Then
           components.Dispose()
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
       Me.llblPangram = New System.Windows.Forms.LinkLabel
       Me.SuspendLayout()
       "
       "llblPangram
       "
       Me.llblPangram.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.llblPangram.Location = New System.Drawing.Point(8, 80)
       Me.llblPangram.Name = "llblPangram"
       Me.llblPangram.Size = New System.Drawing.Size(296, 24)
       Me.llblPangram.TabIndex = 1
       Me.llblPangram.TabStop = True
       Me.llblPangram.Text = "The quick brown fox jumps over the lazy dog."
       "
       "Form1
       "
       Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
       Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
       Me.ClientSize = New System.Drawing.Size(325, 181)
       Me.Controls.Add(Me.llblPangram)
       Me.Name = "Form1"
       Me.Text = "UseLinkLabel"
       Me.ResumeLayout(False)
       Me.PerformLayout()
   End Sub
   Friend WithEvents llblPangram As System.Windows.Forms.LinkLabel

End Class


 </source>


LinkLabel.Links.Add

<source lang="vbnet"> Imports System Imports System.Windows.Forms

Public Class MainClass

   Shared Sub Main()
       Dim form1 As Form = New Form1
       Application.Run(form1)
   End Sub

End Class Public Class Form1

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   Friend WithEvents lnkBuy As System.Windows.Forms.LinkLabel
   Friend WithEvents lnkWebSite As System.Windows.Forms.LinkLabel
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.lnkBuy = New System.Windows.Forms.LinkLabel()
       Me.lnkWebSite = New System.Windows.Forms.LinkLabel()
       Me.SuspendLayout()
       "
       "lnkBuy
       "
       Me.lnkBuy.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.lnkBuy.LinkArea = New System.Windows.Forms.LinkArea(0, 0)
       Me.lnkBuy.Location = New System.Drawing.Point(16, 60)
       Me.lnkBuy.Name = "lnkBuy"
       Me.lnkBuy.Size = New System.Drawing.Size(244, 48)
       Me.lnkBuy.TabIndex = 3
       Me.lnkBuy.Text = "www.vbex.ru"
       "
       "lnkWebSite
       "
       Me.lnkWebSite.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.lnkWebSite.LinkArea = New System.Windows.Forms.LinkArea(0, 0)
       Me.lnkWebSite.Location = New System.Drawing.Point(16, 16)
       Me.lnkWebSite.Name = "lnkWebSite"
       Me.lnkWebSite.Size = New System.Drawing.Size(248, 36)
       Me.lnkWebSite.TabIndex = 2
       Me.lnkWebSite.Text = "The whole line is a LinkLabel"
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(292, 150)
       Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lnkBuy, Me.lnkWebSite})
       Me.Name = "Form1"
       Me.Text = "Link Examples"
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub lnkBuy_LinkClicked(ByVal sender As Object, _
     ByVal e As LinkLabelLinkClickedEventArgs) Handles lnkBuy.LinkClicked, _
     lnkWebSite.LinkClicked
       e.Link.Visited = True
       System.Diagnostics.Process.Start(CType(e.Link.LinkData, String))
   End Sub
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       lnkBuy.Links.Add(0, 2, "http://www.vbex.ru")
       lnkBuy.Links.Add(6, 10, "http://www.vbex.ru")
       lnkWebSite.Links.Add(0, 10, "http://www.vbex.ru")
   End Sub

End Class


 </source>


LinkLabel.Links.IndexOf

<source lang="vbnet"> Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class LinkLabelLocalRemote

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class Public Class Form1

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
   Friend WithEvents Label1 As System.Windows.Forms.Label
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.LinkLabel1 = New System.Windows.Forms.LinkLabel
       Me.Label1 = New System.Windows.Forms.Label
       Me.SuspendLayout()
       "
       "LinkLabel1
       "
       Me.LinkLabel1.Location = New System.Drawing.Point(32, 80)
       Me.LinkLabel1.Name = "LinkLabel1"
       Me.LinkLabel1.Size = New System.Drawing.Size(224, 16)
       Me.LinkLabel1.TabIndex = 0
       Me.LinkLabel1.TabStop = True
       Me.LinkLabel1.Text = "Get more information locally or on the web."
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(292, 273)
       Me.Controls.Add(Me.Label1)
       Me.Controls.Add(Me.LinkLabel1)
       Me.Name = "Form1"
       Me.Text = "Form1"
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       LinkLabel1.Links.Add(21, 7, "locally")
       LinkLabel1.Links.Add(39, 3, "web")
   End Sub
   Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
       LinkLabel1.Links(LinkLabel1.Links.IndexOf(e.Link)).Visited = True
       If (e.Link.LinkData.ToString() = "locally") Then
           Dim InfoWindow As New Form2
           InfoWindow.Show()
       Else
           System.Diagnostics.Process.Start("www.vbex.ru")
       End If
   End Sub

End Class Public Class Form2

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   Friend WithEvents Label1 As System.Windows.Forms.Label
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.Label1 = New System.Windows.Forms.Label
       Me.SuspendLayout()
       "
       "Label1
       "
       Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 24.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.Label1.Location = New System.Drawing.Point(0, 0)
       Me.Label1.Name = "Label1"
       Me.Label1.Size = New System.Drawing.Size(176, 48)
       Me.Label1.TabIndex = 0
       Me.Label1.Text = "Form 2"
       "
       "Form2
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(292, 273)
       Me.Controls.Add(Me.Label1)
       Me.Name = "Form2"
       Me.Text = "Form2"
       Me.ResumeLayout(False)
   End Sub
  1. End Region

End Class


 </source>


LinkLabel.LinkVisited

<source lang="vbnet"> Imports System Imports System.Drawing Imports System.Windows.Forms Public Class MainClass

  Shared Sub Main()
       Dim myform As Form = New FrmLinkLabel()
       Application.Run(myform)
  End Sub " Main

End Class Public Class FrmLinkLabel

  Inherits Form
  1. Region " Windows Form Designer generated code "
  Public Sub New()
     MyBase.New()
     "This call is required by the Windows Form Designer.
     InitializeComponent()
     "Add any initialization after the InitializeComponent() call
  End Sub
  "Form overrides dispose to clean up the component list.
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
     If disposing Then
        If Not (components Is Nothing) Then
           components.Dispose()
        End If
     End If
     MyBase.Dispose(disposing)
  End Sub
  " linklabels to C: drive, www.deitel.ru and Notepad
  Friend WithEvents linkLabel As LinkLabel
  "Required by the Windows Form Designer
  Private components As System.ruponentModel.Container
  "NOTE: The following procedure is required by the Windows Form Designer
  "It can be modified using the Windows Form Designer.  
  "Do not modify it using the code editor.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
     Me.linkLabel = New LinkLabel()
     Me.SuspendLayout()
     "
     "linkLabel
     "
     Me.linkLabel.Location = New System.Drawing.Point(72, 16)
     Me.linkLabel.Name = "linkLabel"
     Me.linkLabel.TabIndex = 0
     Me.linkLabel.TabStop = True
     Me.linkLabel.Text = "Open Notepad"
     "
     "FrmLinkLabel
     "
     Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
     Me.ClientSize = New System.Drawing.Size(364, 149)
     Me.Controls.AddRange(New Control() {Me.linkLabel})
     Me.Name = "FrmLinkLabel"
     Me.Text = "LinkLabelTest"
     Me.ResumeLayout(False)
  End Sub
  1. End Region
  " browse C:\ drive
  Private Sub linkLabel_LinkClicked _
     (ByVal sender As System.Object, ByVal e As _
     System.Windows.Forms.LinkLabelLinkClickedEventArgs) _
     Handles linkLabel.LinkClicked
     linkLabel.LinkVisited = True
     System.Diagnostics.Process.Start("notepad")
 End Sub " linkLabel

End Class


 </source>


LinkLabel.VisitedLinkColor

<source lang="vbnet">

Imports System.Windows.Forms Imports System.Drawing.Text Imports System.Drawing Imports System.Drawing.Drawing2D public class LinkLabelLinkData

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class Public Class Form1

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   End Sub
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       LinkLabel1.Text = "Home Page is www.microsoft.ru"
       LinkLabel1.Links.Add(13, 28, "http://www.microsoft.ru")
       LinkLabel1.LinkArea = New LinkArea(13, 28)
       LinkLabel1.LinkColor = Color.Red
       LinkLabel1.VisitedLinkColor = Color.Aqua
       LinkLabel1.ActiveLinkColor = Color.Pink
       LinkLabel1.Links(0).LinkData = "Register"
   End Sub
   Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
       Label1.Text = LinkLabel1.Text
   End Sub

End Class <Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Class Form1

   Inherits System.Windows.Forms.Form
   "Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing AndAlso components IsNot Nothing Then
           components.Dispose()
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
       Me.LinkLabel1 = New System.Windows.Forms.LinkLabel
       Me.Button1 = New System.Windows.Forms.Button
       Me.Label1 = New System.Windows.Forms.Label
       Me.SuspendLayout()
       "
       "LinkLabel1
       "
       Me.LinkLabel1.AutoSize = True
       Me.LinkLabel1.Location = New System.Drawing.Point(182, 51)
       Me.LinkLabel1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
       Me.LinkLabel1.Name = "LinkLabel1"
       Me.LinkLabel1.Size = New System.Drawing.Size(87, 15)
       Me.LinkLabel1.TabIndex = 0
       Me.LinkLabel1.TabStop = True
       Me.LinkLabel1.Text = "LinkLabel1"
       "
       "Button1
       "
       Me.Button1.Location = New System.Drawing.Point(185, 181)
       Me.Button1.Name = "Button1"
       Me.Button1.Size = New System.Drawing.Size(139, 28)
       Me.Button1.TabIndex = 1
       Me.Button1.Text = "Button1"
       Me.Button1.UseVisualStyleBackColor = True
       "
       "Label1
       "
       Me.Label1.AutoSize = True
       Me.Label1.Location = New System.Drawing.Point(64, 51)
       Me.Label1.Name = "Label1"
       Me.Label1.Size = New System.Drawing.Size(55, 15)
       Me.Label1.TabIndex = 2
       Me.Label1.Text = "Label1"
       "
       "Form1
       "
       Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
       Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
       Me.ClientSize = New System.Drawing.Size(547, 250)
       Me.Controls.Add(Me.Label1)
       Me.Controls.Add(Me.Button1)
       Me.Controls.Add(Me.LinkLabel1)
       Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
       Me.Name = "Form1"
       Me.Text = "Form1"
       Me.ResumeLayout(False)
       Me.PerformLayout()
   End Sub
   Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
   Friend WithEvents Button1 As System.Windows.Forms.Button
   Friend WithEvents Label1 As System.Windows.Forms.Label

End Class


 </source>