winform中linkLabel的用法(示例)

  private   void  Form1_Load( object  sender, EventArgs e)
        
{
            
this.lnkTest.Text = "百度 Google Yahoo";                      
            
this.lnkTest.Links.Add(02"http://www.baidu.com");
            
this.lnkTest.Links.Add(36"http://www.google.com");
        }


        
private   void  lnkTest_LinkClicked( object  sender, LinkLabelLinkClickedEventArgs e)
        
{
            
this.lnkTest.Links[lnkTest.Links.IndexOf(e.Link)].Visited = true;           
            
string target = e.Link.LinkData as string;           
            
if (target!=null && target.StartsWith("http://"))
            
{
                System.Diagnostics.Process.Start(target);
            }

            
else
            
{
                MessageBox.Show(
"Item clicked: " + target);
            }


        }

你可能感兴趣的:(WinForm)