1
A
回答
3
這是我會怎麼做。
Dim linkLa As New LinkLabel
linkLa.LinkColor = Color.Red
Dim link As LinkLabel.Link = linkLa.Links.Add(0, 13, "http://www.stackoverflow.com")
linkLa.Text = "Stackoverflow"
AddHandler linkLa.LinkClicked, AddressOf Link_Clicked
richTextBox1.Controls.Add(linkLa)
Private Sub Link_Clicked(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("clicked")
End Sub
+0
我接受你的答案,但我想顯示的鏈接地址。 – Sopolin 2009-07-21 06:22:36
0
我有一個答案給你。這將允許您顯示鏈接目標地址作爲工具提示。 (幾乎沒有泡沫。)除此之外,它與斯坦R.的答案類似。
- 將這個代碼下的「添加鏈接」按鈕(或任何你要調用它)在你的程序
注:我把每行註釋之前,所以它更容易執行!
'define the text and link targets
Dim linktext As String = LinkTextbox.Text 'LinkTextbox is just the textbox where the user inputs the text of the link
Dim linktarget As String = LinkTargetTextbox.Text 'LinkTargetTextBox is just the textbox where the user inputs the target URL of the link
'Define the LinkLabel
Dim lnk As New LinkLabel
'if you want, you can set the different properties, like font or linkcolor, programmatically after defining the linklabel, for instance:
lnk.LinkColor = Color.Blue
'set tooltip
lnk.Tooltip = linktarget
'set the link target
Dim lk As LinkLabel.Link = lnk.Links.Add(0, 13, linktarget)
'set the link text
lnk.Text = linktext
'EventHandler
AddHandler lnk.LinkClicked, AddressOf LinkClicked
'Add the control to the richtextbox
RichTextBox1.Controls.Add(lnk)
'This is the Subroutine that the label will run when clicked (Make sure to put your "End Sub" before this, because it's not part of the button's subroutine)
Private Sub LinkClicked(ByVal sender As Object, ByVal e As EventArgs)
'send link to the browser
Process.Start(linktarget)
End Sub
相關問題
- 1. Richtextbox庫
- 2. RichTextBox CtrlI
- 3. RichTextBox的字體
- 4. backcolor只讀richtextbox
- 5. Richtextbox Lines.Length == -1
- 6. .NET RichTextBox撤消
- 7. richtextbox行號列
- 8. 打印RichTextBox的
- 9. WPF Richtextbox FontFace/FontSize
- 10. Dumb RichTextBox問題
- 11. WPF RichTextBox和'\ t'
- 12. 不能RichTextBox中
- 13. RichTextBox虛空色
- 14. richtextbox在vb.net
- 15. Richtextbox行數
- 16. RichTextBox默認值?
- 17. 不能RichTextBox的
- 18. 獲取RichTextBox的
- 19. Silverlight RichTextBox和UIElementCollection
- 20. RichTextBox顏色
- 21. 尋找在RichTextBox
- 22. WPF RichTextBox ApplyPropertyValue
- 23. RichTextBox滾動
- 24. WPF RichTextBox GetCharacterRect
- 25. WPF RichTextBox RTL
- 26. RichTextbox MaxLength太小
- 27. WPF richTextBox問題
- 28. 在RichTextBox的
- 29. c#richtextbox outofmemory
- 30. C#.NET RichTextBox GetCharOffsetFromPosition?
有這麼多免費的編輯們那裏只是檢查這些 的FCKeditor的一個google一下 – Nagu 2009-07-21 03:53:39