Multiple links and generic handler : LinkLabel « GUI « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » GUI » LinkLabel 
14.14.5.Multiple links and generic handler
Multiple links and generic handler
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
14.14.LinkLabel
14.14.1.Get LinkData from LinkLabelGet LinkData from LinkLabel
14.14.2.LinkLabel local actionLinkLabel local action
14.14.3.LinkArea in LinkLabelLinkArea in LinkLabel
14.14.4.Link AddLink Add
14.14.5.Multiple links and generic handlerMultiple links and generic handler
14.14.6.Using LinkLabels to create hyperlinksUsing LinkLabels to create hyperlinks
14.14.7.Load File ExploreLoad File Explore
14.14.8.Load BrowserLoad Browser
14.14.9.Load Window ApplicationLoad Window Application
14.14.10.Set Label Border styleSet Label Border style
14.14.11.Set LinkLabel ImageListSet LinkLabel ImageList
14.14.12.LinkLabel: LinkArea, LinkColor, VisitedLinkColor, ActiveLinkColorLinkLabel: LinkArea, LinkColor, VisitedLinkColor, ActiveLinkColor
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.