public HyperlinkDialog() { InitializeComponent(); Model = new HyperlinkObject { URL = "http://" }; OkayButton.Click += new RoutedEventHandler(OkayButton_Click); CancelButton.Click += new RoutedEventHandler(CancelButton_Click); }
/// <summary> /// 执行插入超链接命令 /// </summary> public static void InsertHyperlick(this HtmlDocument document, HyperlinkObject hyperlink) { var url = hyperlink.URL.HtmlEncoding(); var txt = hyperlink.Text.HtmlEncoding(); if (string.IsNullOrEmpty(txt)) { txt = url; } string tx = string.Format("<a href=\"{0}\">{1}</a>", url, txt); document.InsertHTML(tx); }
/// <summary> /// 执行插入超链接命令 /// </summary> public static void InsertHyperlick(this HtmlDocument document, HyperlinkObject hyperlink) { var url = hyperlink.URL.HtmlEncoding(); var txt = hyperlink.Text.HtmlEncoding(); if (string.IsNullOrEmpty(txt)) txt = url; string tx = string.Format("<a href=\"{0}\">{1}</a>", url, txt); document.InsertHTML(tx); }