This method turns the tooltip currently displayed by the tooltip component off. It comes in three overloaded versions common to all tooltip components.[Visual Basic] Public Overloads Sub Reset() Public Overloads Sub Reset(ByVal control As Control) Public Overloads Sub Reset(ByVal control As Control, ByVal clearContent As Boolean)[C#] public void Reset(); public void Reset(Control control); public void Reset(Control control, bool clearContent);
The control, for which the tooltip should be reset.
A flag to indicate whether the tooltip content of control should be cleared or not. (True = clear content; False = keep current content)
Reset() turns off the tooltip currently displayed by the tooltip component. It has the same effect as moving the mouse away from a control, for which the tooltip is displayed.
Usually this method is used in scenarios, where the tooltip has to be started and stopped (reset) by the hosting application. This can often be the case, where the automatic activation/deactivation of the tooltip, which is triggered by the MouseEnter- and MouseLeave-events of a control, does not give the desired results.
An example for this kind of situations is the use of the tooltips with complex controls, such as grid- or tree-controls, where a finer granularity is desired. Many of this complex controls expose events to notify the hosting application that the mouse has entered or left a defined region or element inside of the control (e.g. grid-cells, tree-nodes etc.). This events are usually good places to start respectively reset the corresponding tooltip component.
This issues are discussed and illustrated with working examples in the section with the "Task-based tutorials" and - more specifically - in its subsection on "How to use ToolTips with grid-controls".
If the parameter-less version of Reset() is used, it behaves exactly as if the mouse had left the client-area of a control and - if a tooltip is actually displayed for the control, over which the cursor is hovering - the tooltip will immediately be turned off. (Actually this Reset() is seldom really necessary, because implicitly it is always called when the cursor leaves a control.)
Usually Reset() is used paired with Start() as shown in Example 1.
The overloaded version Reset(control) is declared with public visibilty, but it should not be used by hosting applications. It is used internally by the tooltip components. Therefore it is strongly recommended to avoid the use of this method.
The third overloaded version (Reset(control, clearContent)) can be useful to quickly clear the tooltip-content for a specific control. The following statement will reset (hide) the tooltip for Panel3 and clear its content:
Remember: controls with no assigned tooltip-content will not show tooltips when the cursor hovers over them. Therefore the statement above is a quick way to turn completely off a tooltip for a given control.
The following code starts and stops (resets) the tooltip for Button1 through the MouseEnter- and MouseLeave-events. This is a good way to display tooltip content that could not be assigned at design-time and needs to be updated each time the tooltip is displayed again:
'As soon as the mouse enters the control...Private Sub Button1_MouseEnter(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Button1.MouseEnter
'...we format the current universal time as a string...
Dim utcTime As String = Date.Now.ToUniversalTime.ToShortTimeString
'...and set it as new content for the SingleLineToolTip on Button1.
.Text = "UTC: " & utcTime
'Now the tooltip is ready to be displayed....
'As soon as the mouse leaves the control...Private Sub Button1_MouseLeave(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Button1.MouseLeave
'...we should shut down the tooltip.