private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { if (e.Link != null && e.Link.LinkData != null) { try { if (e.Link.LinkData is KellLinkData) { KellLinkData linkData = (KellLinkData)e.Link.LinkData; if (linkData.Args != null && linkData.Args.Length > 0) { Process.Start(linkData.Uri, linkData.Args[0].ToString()); } else { Process.Start(linkData.Uri); } } else { Process.Start(e.Link.LinkData.ToString()); } } catch// (Exception ex) { //MessageBox.Show(ex.Message); } } } OnLinkClicked(e); }
/// <summary> /// 设置广告的文本、链接地址以及地址参数 /// </summary> /// <param name="text">显示的文本</param> /// <param name="uri">链接的目标地址(可以是网址,也可以是目录/文件)</param> /// <param name="argStr">运行目标地址要调用的参数字符串</param> public void SetLinkAttribute(string text, string uri, string argStr) { this.AdvText = text; KellLinkData linkData = new KellLinkData(uri, argStr); this.AdvLinkData = linkData; }
/// <summary> /// 设置广告的文本和链接对象 /// </summary> /// <param name="text">显示的文本</param> /// <param name="linkData">链接对象</param> public void SetLinkAttribute(string text, KellLinkData linkData) { this.AdvText = text; this.AdvLinkData = linkData; }