CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: ToolTipText

  1. #1
    Join Date
    Aug 1999
    Location
    Québec (Canada)
    Posts
    210

    ToolTipText

    Is't possible to have many line in yellow box (ToolTipText) I tryed with & vbCrLf & but is not good.I have a big sentence to put in ToolTipText.

    Some body have an idea?

    Thanks
    Redg


  2. #2
    Join Date
    May 2001
    Posts
    155

    Re: ToolTipText

    Try This:

    Private Sub Form_Load()
    Dim ch
    Dim par
    ch = Chr$(10)
    par = "Hello" ' First Line
    par = par & ch & "This is tool tip text" ' Second Line
    Label1.TooltipText = par
    End Sub

    Hope this helps

    --bug


  3. #3
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: ToolTipText

    I wonder if you can create you own tooltip box. You can create a label (set all the properties like border, backcolor, forcolor, font and etc as needed) and make it invisible initially. Then trap the controls MouseOver() or MouseMove() events to display the label. Since those events capture the X and Y coordinates, then you can move the label to that point and it becomes a ToolTipText

    -Cool Bizs

    Good Luck,
    -Cool Bizs

  4. #4
    Join Date
    May 2001
    Location
    Big Flats, NY, USA
    Posts
    5

    Re: ToolTipText

    Hmm... it seems that it just won't let you use a multiline tooltiptext.

    I can think of two alternatives:
    1. Do something with the MouseMove event, which is quite elaborate, but I think should work.
    2. Use the control's MouseIcon property, although I'm afraid there is a limit on the size of the icon you want to show.

    Leo


  5. #5
    Join Date
    May 2001
    Location
    Israel
    Posts
    9

    Re: ToolTipText

    Hi, There is an option to Redefine the Tool Tip in VB.
    But it needs alot of api's calls and it is quite long.
    My Email is [email protected] send me an email and i will replay to you with a Sample that works that i found on the web.It has the class module and 2 module and how to implement it.
    I hope this help's.
    Ohad


  6. #6
    Join Date
    Feb 2001
    Location
    PA
    Posts
    163

    Re: ToolTipText

    In the pre-tooltip days this is the way I did it. Use the MouseMove event of the object to pop up a label (visible = true) with the tool tip. If you have just one long tip use just one fixed label, otherewise set the coordinates of the label each time in the MouseMove event of the object. Don't forget to set the label to visible = false for the objects around it so the tool tip dissappears when you move off of the object. Set the label up as follows:
    BorderStyle = 1
    Autosize = true
    Appearance = 0
    Wordwrap = True
    Backcolor = &H80000018&


    private Sub Command1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
    Label1.Visible = true
    DoEvents
    End Sub


    private Sub Form_Load()
    Label1.Caption = "This is a very long Tool Tip. This is a very long Tool Tip.This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip."

    End Sub


    private Sub Form_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
    Label1.Visible = false
    End Sub


    private Sub Label1_Click()
    Label1.Visible = false
    End Sub






  7. #7
    Join Date
    Aug 1999
    Location
    Québec (Canada)
    Posts
    210

    Re: ToolTipText

    Thanks a lot for your solution.

    But...when the tooltip appear (label1) it's was behind the other object like button or label.

    I tryed to use the properties bring to front for label1 or send to back for the other object but is not good.
    Thanks in advance
    Régis


  8. #8
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: ToolTipText

    You can use a textbox, setting its property to be flat and having same backcolor...

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  9. #9
    Join Date
    Feb 2001
    Location
    PA
    Posts
    163

    Re: ToolTipText

    Now that you mentioned it I believe I used a Sheridan panel in lieu of a label.
    Try a panel and you should be able to bring it to the front. I think a label is a lightweight control.

    Cubbie


  10. #10
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: ToolTipText

    See the sample in
    http://msdn.microsoft.com/vbasic/dow...oad.asp?ID=032

    It might be of use in creating your own tool tips



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured