本文整理匯總了VB.NET中System.Windows.Forms.LinkLabel.LinkVisited屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET LinkLabel.LinkVisited屬性的具體用法?VB.NET LinkLabel.LinkVisited怎麽用?VB.NET LinkLabel.LinkVisited使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Windows.Forms.LinkLabel
的用法示例。
在下文中一共展示了LinkLabel.LinkVisited屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: keywords
' Declare the LinkLabel object.
Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
' Declare keywords array to identify links
Dim keywords() As String
Private Sub InitializeLinkLabel()
Me.LinkLabel1 = New System.Windows.Forms.LinkLabel
Me.LinkLabel1.Links.Clear()
' Set the location, name and size.
Me.LinkLabel1.Location = New System.Drawing.Point(10, 20)
Me.LinkLabel1.Name = "CompanyLinks"
Me.LinkLabel1.Size = New System.Drawing.Size(104, 150)
' Set the LinkBehavior property to show underline when mouse
' hovers over the links.
Me.LinkLabel1.LinkBehavior = _
System.Windows.Forms.LinkBehavior.HoverUnderline
Dim textString As String = "For more information see our" & _
" company website or the research page at Contoso Ltd. "
' Set the text property.
Me.LinkLabel1.Text = textString
' Set the color of the links to black, unless the mouse
' is hovering over a link.
Me.LinkLabel1.LinkColor = System.Drawing.Color.Black
Me.LinkLabel1.ActiveLinkColor = System.Drawing.Color.Blue
' Add links to the LinkCollection using starting index and
' length of keywords.
keywords = New String() {"company", "research"}
Dim keyword As String
For Each keyword In keywords
Me.LinkLabel1.Links.Add(textString.IndexOf(keyword), keyword.Length)
Next
' Add the label to the form.
Me.Controls.Add(Me.LinkLabel1)
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As Object, _
ByVal e As LinkLabelLinkClickedEventArgs) _
Handles LinkLabel1.LinkClicked
Dim url As String
' Determine which link was clicked and set the appropriate url.
Select Case LinkLabel1.Links.IndexOf(e.Link)
Case 0
url = "www.microsoft.com"
Case 1
url = "www.contoso.com/research"
End Select
' Set the visited property to True. This will change
' the color of the link.
e.Link.Visited = True
' Open Internet Explorer to the correct url.
System.Diagnostics.Process.Start("IExplore.exe", url)
End Sub
示例2: MainClass
' 導入命名空間
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
#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.com and Notepad
Friend WithEvents linkLabel As LinkLabel
'Required by the Windows Form Designer
Private components As System.ComponentModel.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
#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