带HTML链接的RTF文件 [英] RTF file with HTML link
问题描述
如何将该URL添加为我在这里编辑"?我的RTF文件中的实时链接?
How can I add this URL as a "I editted here" live link in my RTF file?
Dim rtb As New RichTextBox
rtb.Text = " Company name" & vbCrLf & vbCrLf & " www.ureleiz.com"
在Word中,链接必须经过格式化. VB.net中有这种格式吗?
In Word, the link must be formatted. Is there a formatting for this in VB.net?
推荐答案
如何将该URL作为实时链接添加到我的RTF文件中?
How can I add this URL as a live link in my RTF file?
Dim rtb As New RichTextBox
rtb.Text = " Company name" & vbCrLf & vbCrLf & " www.ureleiz.com"
在Word中,链接必须经过格式化. VB.net中有这种格式吗?
In Word, the link must be formatted. Is there a formatting for this in VB.net?
这取决于您所说的实时".
It depends on what you mean by 'live'.
如果要使其成为嵌入式RTF格式指定的链接,则必须编辑RTF.那是可能的,但是很复杂.在这里讨论:
http://stackoverflow.com/questions/2850575/what-is-超链接的RTF语法
If you want it to be a link that is specified by embedded RTF formatting then you have to edit the RTF. That is possible, but complex. It is discussed here:
http://stackoverflow.com/questions/2850575/what-is-the-rtf-syntax-for-a-hyperlink
如果您希望它作为RichtextBox中的链接处于活动状态,则过程会更简单.确保RichTextBox属性'DetectURLs'设置为True.然后添加一个LinkCLicked事件的处理程序,该事件将在用户单击时引发. 链接.然后将链接作为文本的一部分.
If you want it to be active as a link in your RichtextBox, then the procedure is simpler. Make sure the RichTextBox property 'DetectURLs' is set to True. Then add a handler for the LinkCLicked event that will be raised when the user clicks in the link. Then include the link as part of the text.
Private Sub RichTextBox1_LinkClicked(sender As Object, e As LinkClickedEventArgs) Handles RichTextBox1.LinkClicked
System.Diagnostics.Process.Start(e.LinkText)
End Sub
这篇关于带HTML链接的RTF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!