Toolbar's Tooltip Visibility
can anyone have any idea about how to increase toolbar's tooltip visibility time, by default it is 5 seconds i want to increase by 10 seconds.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
jaswant singhPosted Jan 4, 2007, 11:43 PM
Actually i have a already developed software, in which we have to change the requirement and i cant change the toolbar, is there any possible way in VS .Net 2003 with Toolbar or any other possible way to increase toolbar's tooltip visibility time.
Scott LyslePosted Jan 4, 2007, 9:22 AM
You can do it but it is sort of messy:
With a form, a toolstrip, two toolstrip buttons, on toolTip.
the tooltip autopopdelay was set to 10000, all tooltip text properties will set to nothing, the toolstrips ShowItemTooltips property was set to false.
Use an integer variable to keep track of the current toolbar button (currentToolstripControl)
Update this variable using the mouse enter event for each toolstrip control (to either 0 or 1).
Used the toolstrip's mouse hover event to set the text for and to display the tooltip. Whenever the mouse leaves any of the toolstrip controls or the toolstrip, hide the tooltip.
Here is the code I used:
using
System;using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace
junk{
public partial class junk : Form
{
int currentToolstripControl;
public junk()
{
InitializeComponent();
} private void toolStrip1_MouseHover(object sender, EventArgs e)
{ try
{
ToolStripItem item;
item = toolStrip1.Items[currentToolstripControl];
switch (item.Name)
{
case "toolStripButton1":
toolTip1.Show("This is the first button", toolStrip1);
break;
case "toolStripButton2":
toolTip1.Show("This is the second button", toolStrip1);
break;
}
}catch { }
} private void toolStrip1_MouseLeave(object sender, EventArgs e)
{
toolTip1.Hide(toolStrip1);
} private void toolStripButton1_MouseEnter(object sender, EventArgs e)
{
currentToolstripControl = 0;
} private void toolStripButton2_MouseEnter(object sender, EventArgs e)
{
currentToolstripControl = 1;
} private void toolStripButton1_MouseLeave(object sender, EventArgs e)
{
toolTip1.Hide(toolStrip1);
} private void toolStripButton2_MouseLeave(object sender, EventArgs e)
{
toolTip1.Hide(toolStrip1);
}
}
}
jaswant singhPosted Jan 4, 2007, 8:04 AM
but there is not any such property for toolbar's tooltip.
i want to increase tooltip visibilty time for toolbar when mouse remain on toolbar.
AutoPopDelay property is available in custom tooltips but when we attach this tooltip with our toolbar button it will give error.
the code which we write is :
tooltip1.AutoPopDelay = 10000;
tooltip1.InitialDelay = 1000;
tooltip1.ReshowDelay = 500;
tooltip1.SetToolTip(toolBarButton1,"Hello");
the error comes as :
Argument '1': cannot convert from 'System.Windows.Forms.ToolBarButton' to 'System.Windows.Forms.Control'
when we pass toolbar name in place of toolbar button then it will run but the tooltip is applied for whole toolbar and same tooltip comes on each toolbar button and we want different tooltips on different buttons.
have u any idea
it's urgent.
Scott LyslePosted Jan 4, 2007, 7:48 AM
Just set the tooltip's AutoPopDelay property from 5000 to 10000; this property controls the dwell time for the display of the tooltip; the value is in milliseconds.