gbarcalow
asked on
How to add a tooltip to an extended richtextbox link
I was wondering if there was a way to add tooltip text to a link located in a richtextboxex.
Thanks
Geoff
Thanks
Geoff
ASKER
No I need a tooltip for the link text inside the richtextbox
This is close as I can get
Private Sub RichTextBox1_LinkClicked(B yVal sender As Object, ByVal e As System.Windows.Forms.LinkC lickedEven tArgs) Handles RichTextBox1.LinkClicked
tipView.SetToolTip(Me.Rich TextBox1, "Here to link")
e.GetType()
End Sub
Private Sub RichTextBox1_LinkClicked(B
tipView.SetToolTip(Me.Rich
e.GetType()
End Sub
ASKER
I have to following code
my problem is that "txtData.GetCharIndexFromP osition" is not returning the expected values.
To me it seems to choose a random integer for each line that you move over.
I think that if I could get the real index from txtData.GetCharIndexFromPo sition this code would work.
Private Sub txtData_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles txtData.MouseMove
Dim pt As Point = New Point(e.Y, e.Y)
Dim link As Integer = txtData.GetCharIndexFromPo sition(pt)
If isLink(link) = True Then
tt_txtData.Active = True
tt_txtData.SetToolTip(txtD ata, "Click Here to open document")
Else
tt_txtData.Active = False
End If
End Sub
Private Function isLink(ByVal i As Integer)
Dim sData As String = txtData.Text
Dim strBeg As String = Replace(Strings.Left(sData , i), vbCrLf, " ")
Dim strEnd As String = Replace(Strings.Right(sDat a, Len(sData) - i), vbCrLf, " ")
Dim strComplete = Strings.Right(strBeg, Len(strBeg) - InStrRev(strBeg, " "))
strComplete += Strings.Left(strEnd, InStr(strEnd, " "))
If UCase(Strings.Left(strComp lete, 7)) = "HTTP://" Or _
UCase(Strings.Left(strComp lete, 7)) = "FILE://" Then
Return True
Else
Return False
End If
End Function
my problem is that "txtData.GetCharIndexFromP
To me it seems to choose a random integer for each line that you move over.
I think that if I could get the real index from txtData.GetCharIndexFromPo
Private Sub txtData_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles txtData.MouseMove
Dim pt As Point = New Point(e.Y, e.Y)
Dim link As Integer = txtData.GetCharIndexFromPo
If isLink(link) = True Then
tt_txtData.Active = True
tt_txtData.SetToolTip(txtD
Else
tt_txtData.Active = False
End If
End Sub
Private Function isLink(ByVal i As Integer)
Dim sData As String = txtData.Text
Dim strBeg As String = Replace(Strings.Left(sData
Dim strEnd As String = Replace(Strings.Right(sDat
Dim strComplete = Strings.Right(strBeg, Len(strBeg) - InStrRev(strBeg, " "))
strComplete += Strings.Left(strEnd, InStr(strEnd, " "))
If UCase(Strings.Left(strComp
UCase(Strings.Left(strComp
Return True
Else
Return False
End If
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So that pretty much rules out using word wrap huh?
or can you use a LinkLabel control?