I\'m currently adding a tooltip to a label like so:
ToolTip LabelToolTip = new System.Windows.Forms.ToolTip();
LabelToolTip.SetToolTip(this.LocationLabel, te
public class ToolTipHelper
{
private readonly Dictionary tooltips;
///
/// Constructor
///
public ToolTipHelper()
{
this.tooltips = new Dictionary();
}
///
/// Key a tooltip by its control name
///
///
///
public ToolTip GetControlToolTip(string controlName)
{
if (tooltips.ContainsKey(controlName))
{
return tooltips[controlName];
}
else
{
ToolTip tt = new ToolTip();
tooltips.Add(controlName, tt);
return tt;
}
}
}
Usage:
var tt = toolTips.GetControlToolTip("button1");
tt.SetToolTip(button1, "This is my button1 tooltip");
tt = toolTips.GetControlToolTip("button2");
tt.SetToolTip(button2, "This is my button2 tooltip");