System.Windows.Forms.ToolTip.SetToolTip C# (CSharp) Method

SetToolTip() public method

public SetToolTip ( Control control, string caption ) : void
control Control
caption string
return void
		public void SetToolTip(Control control, string caption) {
			// UIA Framework
			OnUIAToolTipHookUp (this, new ControlEventArgs (control));
			tooltip_strings[control] = caption;

			// no need for duplicates
			if (!controls.Contains(control)) {
				control.MouseEnter += new EventHandler(control_MouseEnter);
				control.MouseMove += new MouseEventHandler(control_MouseMove);
				control.MouseLeave += new EventHandler(control_MouseLeave);
				control.MouseDown += new MouseEventHandler (control_MouseDown);
				controls.Add(control);
			}
			
			// if SetToolTip is called from a control and the mouse is currently over that control,
			// make sure that tooltip_window.Text gets updated if it's being shown,
			// or show the tooltip for it if is not
			if (active_control == control && caption != null && state == TipState.Show) {
				//TODO:fixme
				Size size = Size.Empty;//ThemeEngine.Current.ToolTipSize(tooltip_window, caption);
				tooltip_window.Width = size.Width;
				tooltip_window.Height = size.Height;
				tooltip_window.Text = caption;
				timer.Stop ();
				timer.Start ();
			} else if (control.IsHandleCreated && MouseInControl (control, false))
				ShowTooltip (control);
		}

Usage Example

 public void SetToolTip(ref ToolTip toolTip, string groupTypeName)
 {
     // TODO old implementation has textBox tooltips that don't work
     toolTip.SetToolTip(labelQuick, String.Format(International.GetText("Form_Settings_ToolTip_BenchmarkTimeLimits"), International.GetText("Quick"), groupTypeName) + ".");
     toolTip.SetToolTip(labelStandard, String.Format(International.GetText("Form_Settings_ToolTip_BenchmarkTimeLimits"), International.GetText("Standard"), groupTypeName) + ".");
     toolTip.SetToolTip(labelPrecise, String.Format(International.GetText("Form_Settings_ToolTip_BenchmarkTimeLimits"), International.GetText("Standard"), groupTypeName) + ".");
 }
All Usage Examples Of System.Windows.Forms.ToolTip::SetToolTip