Answered by:
Tool Tips For Menu Items

Question
-
The Tool Tip available to use with menu items in Visual Basic 2010 does not have the capability of Baloon shape or any formatting of the text. If I drag a Tool Tip control to the form, menu items don't recognize it and provide noability to improve the appearance.
Is there any way to fix this, or am I doing somethingwrong.
Milt
sirmilt
Monday, October 21, 2013 5:34 PM
Answers
-
Perhaps this will help you although using the balloon tip doesn't point in the right direction unless you put the balloon on top.
Option Strict On Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.CenterToScreen() End Sub Private Sub HelloToolStripMenuItem_MouseHover(sender As Object, e As EventArgs) Handles HelloToolStripMenuItem.MouseHover Dim tooltip1 As New ToolTip tooltip1.IsBalloon = False tooltip1.ToolTipIcon = ToolTipIcon.Warning tooltip1.ToolTipTitle = "Hellos ToolTip" tooltip1.Show("Hellos tool tip information", _ MenuStrip1, New Point(CInt(HelloToolStripMenuItem.Width / 2 - 20), +30), 5000) End Sub Private Sub GoodbyeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GoodbyeToolStripMenuItem.MouseHover Dim tooltip1 As New ToolTip tooltip1.IsBalloon = False tooltip1.ToolTipIcon = ToolTipIcon.Warning tooltip1.ToolTipTitle = "Goodbyes ToolTip" tooltip1.Show("GoodByes tool tip information", _ MenuStrip1, New Point(CInt(GoodbyeToolStripMenuItem.Width / 2 - 20), +50), 5000) End Sub End Class
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
- Edited by Mr. Monkeyboy Monday, October 21, 2013 6:59 PM 5555
- Proposed as answer by The Thinker Tuesday, October 22, 2013 12:04 AM
- Marked as answer by Franklin ChenMicrosoft employee Tuesday, October 29, 2013 9:53 AM
Monday, October 21, 2013 6:57 PM -
This will make the tooltip on the first item disappear when you move the mouse to the second item (from hello to goodbye) and vice versa.
Option Strict On Public Class Form1 Dim tooltip1 As ToolTip Dim tooltip2 As ToolTip Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.CenterToScreen() End Sub Private Sub HelloToolStripMenuItem_MouseHover(sender As Object, e As EventArgs) Handles HelloToolStripMenuItem.MouseHover tooltip1 = New ToolTip tooltip1.IsBalloon = True tooltip1.ToolTipIcon = ToolTipIcon.Warning tooltip1.ToolTipTitle = "Hellos ToolTip" tooltip1.Show("Hellos tool tip information", _ MenuStrip1, New Point(CInt(HelloToolStripMenuItem.Width / 2 - 20 + 10), -73), 5000) End Sub Private Sub HelloToolStripMenuItem_LostFocus(sender As Object, e As EventArgs) Handles HelloToolStripMenuItem.MouseLeave tooltip1.Active = False End Sub Private Sub GoodbyeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GoodbyeToolStripMenuItem.MouseHover tooltip2 = New ToolTip tooltip2.IsBalloon = True tooltip2.ToolTipIcon = ToolTipIcon.Warning tooltip2.ToolTipTitle = "Goodbyes ToolTip" tooltip2.Show("GoodByes tool tip information", _ MenuStrip1, New Point(CInt(GoodbyeToolStripMenuItem.Width / 2 - 20 + 10), -53), 5000) End Sub Private Sub GoodbyeToolStripMenuItem_LostFocus(sender As Object, e As EventArgs) Handles GoodbyeToolStripMenuItem.MouseLeave tooltip2.Active = False End Sub End Class
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
- Edited by Mr. Monkeyboy Tuesday, October 22, 2013 3:37 AM 5555
- Marked as answer by Franklin ChenMicrosoft employee Tuesday, October 29, 2013 9:54 AM
Tuesday, October 22, 2013 3:34 AM -
Thank you both for the help. Following your suggestions, the ToolTip worked fine. The only issue I have is the position of the resulting ToolTip from the line of code:
MenuStrip1, New Point(CInt(GoodbyeToolStripMenuItem.Width / 2 - 20 + 10), -53),
Other than the width, I am not sure what the other numbers represent.
Milt
sirmilt
The other number represents how far up or down from the MenuStrip the tool tip appears. So if you have numerous menu items you will have to move the tooltip for that menu item down to hover over the one that the mouse is over. The greater the second number increases the lower the ToolTip will go. It's originally at -73 to place the balloon tip of the tool tip over the first menu item. So thats -73 pixels, or points Y I suppose, for the top of the ToolStrip item to be above the MenuStrip I think and it's 73 pixels high including the balloon tip I guess so its balloon tip is right over the first menu item, -53 for the second menu item and so on.
See my second post to use a good version of what my first post contained as the second post shows the balloon version and instantiates multiple ToolTips so you can activate or deactive a non in use tool strip when the mouse leaves that menu item and hovers over a different menu item.
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
- Edited by Mr. Monkeyboy Tuesday, October 22, 2013 3:55 PM 5555
- Marked as answer by Franklin ChenMicrosoft employee Tuesday, October 29, 2013 9:53 AM
Tuesday, October 22, 2013 3:54 PM
All replies
-
Perhaps this will help you although using the balloon tip doesn't point in the right direction unless you put the balloon on top.
Option Strict On Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.CenterToScreen() End Sub Private Sub HelloToolStripMenuItem_MouseHover(sender As Object, e As EventArgs) Handles HelloToolStripMenuItem.MouseHover Dim tooltip1 As New ToolTip tooltip1.IsBalloon = False tooltip1.ToolTipIcon = ToolTipIcon.Warning tooltip1.ToolTipTitle = "Hellos ToolTip" tooltip1.Show("Hellos tool tip information", _ MenuStrip1, New Point(CInt(HelloToolStripMenuItem.Width / 2 - 20), +30), 5000) End Sub Private Sub GoodbyeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GoodbyeToolStripMenuItem.MouseHover Dim tooltip1 As New ToolTip tooltip1.IsBalloon = False tooltip1.ToolTipIcon = ToolTipIcon.Warning tooltip1.ToolTipTitle = "Goodbyes ToolTip" tooltip1.Show("GoodByes tool tip information", _ MenuStrip1, New Point(CInt(GoodbyeToolStripMenuItem.Width / 2 - 20), +50), 5000) End Sub End Class
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
- Edited by Mr. Monkeyboy Monday, October 21, 2013 6:59 PM 5555
- Proposed as answer by The Thinker Tuesday, October 22, 2013 12:04 AM
- Marked as answer by Franklin ChenMicrosoft employee Tuesday, October 29, 2013 9:53 AM
Monday, October 21, 2013 6:57 PM -
For a ToolstripMenuItem, there is the .ToolTipText property, but it only draws an ordinary rectangular tooltip. It isn't the same as a ToolTip control. For anything else, I think you will have to devise your own solution. You might be able to get some useful bits of code from A ToolTip with Title, Multiline Contents, and Image.
--
AndrewMonday, October 21, 2013 7:03 PM -
This will make the tooltip on the first item disappear when you move the mouse to the second item (from hello to goodbye) and vice versa.
Option Strict On Public Class Form1 Dim tooltip1 As ToolTip Dim tooltip2 As ToolTip Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.CenterToScreen() End Sub Private Sub HelloToolStripMenuItem_MouseHover(sender As Object, e As EventArgs) Handles HelloToolStripMenuItem.MouseHover tooltip1 = New ToolTip tooltip1.IsBalloon = True tooltip1.ToolTipIcon = ToolTipIcon.Warning tooltip1.ToolTipTitle = "Hellos ToolTip" tooltip1.Show("Hellos tool tip information", _ MenuStrip1, New Point(CInt(HelloToolStripMenuItem.Width / 2 - 20 + 10), -73), 5000) End Sub Private Sub HelloToolStripMenuItem_LostFocus(sender As Object, e As EventArgs) Handles HelloToolStripMenuItem.MouseLeave tooltip1.Active = False End Sub Private Sub GoodbyeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GoodbyeToolStripMenuItem.MouseHover tooltip2 = New ToolTip tooltip2.IsBalloon = True tooltip2.ToolTipIcon = ToolTipIcon.Warning tooltip2.ToolTipTitle = "Goodbyes ToolTip" tooltip2.Show("GoodByes tool tip information", _ MenuStrip1, New Point(CInt(GoodbyeToolStripMenuItem.Width / 2 - 20 + 10), -53), 5000) End Sub Private Sub GoodbyeToolStripMenuItem_LostFocus(sender As Object, e As EventArgs) Handles GoodbyeToolStripMenuItem.MouseLeave tooltip2.Active = False End Sub End Class
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
- Edited by Mr. Monkeyboy Tuesday, October 22, 2013 3:37 AM 5555
- Marked as answer by Franklin ChenMicrosoft employee Tuesday, October 29, 2013 9:54 AM
Tuesday, October 22, 2013 3:34 AM -
Thank you both for the help. Following your suggestions, the ToolTip worked fine. The only issue I have is the position of the resulting ToolTip from the line of code:
MenuStrip1, New Point(CInt(GoodbyeToolStripMenuItem.Width / 2 - 20 + 10), -53),
Other than the width, I am not sure what the other numbers represent.
Milt
sirmilt
Tuesday, October 22, 2013 3:46 PM -
Thank you both for the help. Following your suggestions, the ToolTip worked fine. The only issue I have is the position of the resulting ToolTip from the line of code:
MenuStrip1, New Point(CInt(GoodbyeToolStripMenuItem.Width / 2 - 20 + 10), -53),
Other than the width, I am not sure what the other numbers represent.
Milt
sirmilt
The other number represents how far up or down from the MenuStrip the tool tip appears. So if you have numerous menu items you will have to move the tooltip for that menu item down to hover over the one that the mouse is over. The greater the second number increases the lower the ToolTip will go. It's originally at -73 to place the balloon tip of the tool tip over the first menu item. So thats -73 pixels, or points Y I suppose, for the top of the ToolStrip item to be above the MenuStrip I think and it's 73 pixels high including the balloon tip I guess so its balloon tip is right over the first menu item, -53 for the second menu item and so on.
See my second post to use a good version of what my first post contained as the second post shows the balloon version and instantiates multiple ToolTips so you can activate or deactive a non in use tool strip when the mouse leaves that menu item and hovers over a different menu item.
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
- Edited by Mr. Monkeyboy Tuesday, October 22, 2013 3:55 PM 5555
- Marked as answer by Franklin ChenMicrosoft employee Tuesday, October 29, 2013 9:53 AM
Tuesday, October 22, 2013 3:54 PM