Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format Tooltip Text

Status
Not open for further replies.

Ferlin

Programmer
Jan 18, 2001
71
US
Hello All,

I have a tooltip control in my application, and have it displaying what I want, now I would like to format the text a little.

I would like to make the tooltip background black with a yellow border.

I would then like the tooltip title to be displayed in bold white, and the tooltip text displayed in a yellow color.

How would I do this in vs 2005 vb.net?

Thanks in advance.

P.S: Eventually I would like to have multiline text, and be able to change the color on particular lines, but for now, the above will get me going in the right direction.
 
Anyone have some suggestions on this please.

Thanks.
 
Here is the code I am currently using copied and pasted here.

Code:
    Private Sub pbBuff01_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles pbBuff01.MouseHover
        Dim cb As New clsBuffs("buffers.xml")
        cb.ParseBuffers()
        ToolTip1.BackColor = Color.Black
        ToolTip1.ForeColor = Color.White
        ToolTip1.ToolTipTitle = cb.NameBuff01

    End Sub

    Private Sub pbBuff01_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles pbBuff01.MouseLeave
        ToolTip1.ToolTipTitle = ""
        ToolTip1.SetToolTip(pbBuff01, "")
        SetBuffToolTips()
        ToolTip1.BackColor = ToolTipBackColor
        ToolTip1.ForeColor = ToolTipForeColor

    End Sub

    Private Sub SetBuffToolTips()
        Dim cb As New clsBuffs("buffers.xml")
        cb.ParseBuffers()
        ToolTip1.ForeColor = Color.Yellow
        ToolTip1.SetToolTip(pbBuff01, cb.EffectBuff01)
        ToolTip1.SetToolTip(pbBuff02, cb.EffectBuff02)
        ToolTip1.SetToolTip(pbBuff03, cb.EffectBuff03)
        ToolTip1.SetToolTip(pbBuff04, cb.EffectBuff04)
        ToolTip1.SetToolTip(pbBuff05, cb.EffectBuff05)
        ToolTip1.SetToolTip(pbBuff06, cb.EffectBuff06)
        ToolTip1.SetToolTip(pbBuff07, cb.EffectBuff07)
        ToolTip1.SetToolTip(pbBuff08, cb.EffectBuff08)
        ToolTip1.SetToolTip(pbBuff09, cb.EffectBuff09)
        ToolTip1.SetToolTip(pbBuff10, cb.EffectBuff10)
    End Sub

I save off the forecolor and backcolor of the tooltip control in my form load routine so I can restore it, so all the other controls on the form has the default tooltip properties.

This code works, but the tooltip text and title is in white of course, and a black background with no visible border, since the default border is black.

Hope this helps.

Ferlin.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top