本文整理汇总了VB.NET中System.Windows.Forms.LinkLabel.ActiveLinkColor属性的典型用法代码示例。如果您正苦于以下问题:VB.NET LinkLabel.ActiveLinkColor属性的具体用法?VB.NET LinkLabel.ActiveLinkColor怎么用?VB.NET LinkLabel.ActiveLinkColor使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.LinkLabel 的用法示例。
在下文中一共展示了LinkLabel.ActiveLinkColor属性的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
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:63,代码来源:LinkLabel.ActiveLinkColor
示例2: LinkLabelLinkData
' 导入命名空间
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.com"
LinkLabel1.Links.Add(13, 28, "http://www.microsoft.com")
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.CompilerServices.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.ComponentModel.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
开发者ID:VB程序员,项目名称:System.Windows.Forms,代码行数:106,代码来源:LinkLabel.ActiveLinkColor
注:本文中的System.Windows.Forms.LinkLabel.ActiveLinkColor属性示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论