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);
            }


        }
posted @ 2008-01-29 14:30  菩提树下的杨过  阅读(2987)  评论(2编辑  收藏  举报