Solved

Balloon ToolTip Popups are offset from the mouse

Posted on 2007-04-04
4
1,398 Views
Last Modified: 2008-01-09
I have a application that has a treeview written in vb.net 2005.  When I try to display a balloon tooltip popup, the tooltip doesn't line up with the mouse.  The arrow of the balloon tooltip show up about 2 nodes below of where the mouse is.

The application is like the windows explorer.  It has a MenuStrip, a ToolStrip, a Split Container with a treeview docked in the left panel and a listview docked in the right panel and a statusStrip on the bottom.

Any ideas how to make the Balloon tooltip align properly with the mouse?

Here's my tooltip code:

Public Class Form1
    Private oldNodeIndex As Integer = -1
    Private toolTip1 As ToolTip
'grabbed from: http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c91c.aspx#q928q
    Private Sub TreeView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseMove
        Dim tn As TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y)
        If Not (tn Is Nothing) Then
            Dim currentNodeIndex As Integer = tn.Index
            If currentNodeIndex <> oldNodeIndex Then
                oldNodeIndex = currentNodeIndex
                If Not (Me.toolTip1 Is Nothing) And Me.toolTip1.Active Then
                    Me.toolTip1.Active = False 'turn it off
                End If
                Me.toolTip1.SetToolTip(Me.TreeView1, String.Format("tooltip: node {0}", oldNodeIndex))
                Me.toolTip1.ToolTipTitle = tn.Index
                Me.toolTip1.Active = True 'make it active so it can show
            End If
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.toolTip1 = New System.Windows.Forms.ToolTip()
        Me.toolTip1.InitialDelay = 500
        Me.toolTip1.ReshowDelay = 0
        Me.toolTip1.IsBalloon = True
        Me.toolTip1.UseAnimation = True
        Me.toolTip1.UseFading = True
    End Sub
End Class


0
Comment
Question by:Pber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 18851928
I don't think that you can control the location for the ToolTip object.

Bob
0
 
LVL 26

Author Comment

by:Pber
ID: 18857677
Thanks for the info.  You'd think the balloon tooltip arrow align with the mouse.

I did something like this with a custom tooltip class in .net 2003 and that seemed to work.  I'll have to see if I can find that.

Thanks.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18857715
I would be interested to find anything that would allow that kind of control.  It would definitely go into my bag-o-tricks ;)

Bob
0
 
LVL 26

Author Comment

by:Pber
ID: 18857916
I'll take a look this weekend at home and see if I can find it.  I think it used API's, so that's why I was trying to do it natively with the tooltip object.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question