שתף באמצעות


How to extend the duration show time for Tooltip?

Question

Thursday, July 28, 2011 8:41 AM

Hello,

The maximum value that works for AutoPopDelay property of ToolTip is 30 seconds (30000 milliseconds). Any values greater than this maximum will be defaulted to 5 seconds (5000 milliseconds).

http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltip.autopopdelay.aspx

How to set to  extend the duration show time for ToolTip? or alway show until the mouse leave the control?

Thank you

All replies (4)

Thursday, July 28, 2011 9:39 AM ✅Answered

You can achieve this by handling MouseEnter event of the control on which tooltip is to be displayed.

And then use ToolTip1.Show() method.

Sample code

Public Class Form1

  Private Sub Button1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
    ToolTip1.Show("Test Tip", Button1)
  End Sub
End Class
Thanks,
A.m.a.L Hashim

Dot Net Goodies
Don't hate the hacker, hate the code

Thursday, July 28, 2011 11:36 PM ✅Answered | 1 vote

Hi ALL,

The code here shows the ToolTip for a minute.

I've given it a go like this:>>

 MyToolTip.Show("Hi from Button1!!", Me, Me.PointToClient(Cursor.Position), seconds * 1000)

 

as in the code below. Add one Button to a FORM to try it as below please.  :-)

 

Option Strict On
Option Explicit On
Option Infer Off

Public Class Form1

  Friend WithEvents MyToolTip As New ToolTip

  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    MyToolTip.InitialDelay = 0
    MyToolTip.ShowAlways = True
    MyToolTip.UseAnimation = False
    MyToolTip.Active = True

  End Sub

  Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover

    'Show the tooltip for 60 seconds at the mouse location:>>
    Dim seconds As Integer = 60
    MyToolTip.Show("Hi from Button1!!", Me, Me.PointToClient(Cursor.Position), seconds * 1000) '<<: Note the duration is in milliseconds so multiply seconds by 1000

  End Sub

End Class
Regards, John

Click this link to see how to insert a picture into a forum post.

Installing VB6 on Windows 7

XNA is coming to VB.Net

App Hub forums


Thursday, July 28, 2011 8:29 PM | 1 vote

Hi Gayxq

Thank you for your post

Please kindly check this link out:

ToolTip.Show Method (String, IWin32Window, Point, Int32)
http://msdn.microsoft.com/en-us/library/tksk5312.aspx

Sets the ToolTip text associated with the specified control, and then displays the ToolTip for the specified duration at the specified relative position.

 'Declaration

  'Public Sub Show(ByVal text As String, ByVal window As IWin32Window, ByVal point As Point, ByVal duration As Integer)

  toolTip1.Show("Hello World", Button1, newpoint, 50000000)

 

I still have some difficulty to control the position, but this method does keep the tooltip for a very long time. Hope this help and please would some Seniors throw some light on the position, Thank youi.

I tried to set to button1.location, the tooltip appears half way down the screen, then I used the point(size) which gave more acceptable outcome. Thank you all for your time and contribuition. Very appreciated.

P.S I figure it out. Thank you anyway.

Be a good forum member. Make this forum a great place to meet and interact with others around the world.


Friday, July 29, 2011 12:10 AM

Thank you John Anthony Oliver appreciate that.Be a good forum member. Make this forum a great place to meet and interact with others around the world.