We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display the SuperToolTip for disabled controls?

Platform: WinForms |
Control: SuperToolTip |
Published Date: November 27, 2014 |
Last Revised Date: November 27, 2020

You can display the SuperToolTip for disabled controls when mouse over on it. For the disabled controls, mouse pointer notification and events related to that are not triggered. This requirement can be achieved by handling the parent form's MouseMove event and the GetChildAtPoint function.

 

Purpose of GetChildAtPoint:

This function retrieves the child control that is located at the specified coordinates. So, when the cursor points over a specified control, the SuperToolTip can be displayed.

 

C#

bool IsShown = false;
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
    Control ctrl = this.GetChildAtPoint(e.Location);
    if (ctrl != null)
    {
        if (ctrl == this.buttonAdv1 && !IsShown)
        {
            //Initializes the ToolTipInfo
            ToolTipInfo tooltip = new ToolTipInfo();
            tooltip.Body.Text = "SuperToolTip";
            //Sets the SuperToolTip
            this.superToolTip1.SetToolTip(this.buttonAdv1, tooltip);
            System.Drawing.Point pt1 = new System.Drawing.Point(ctrl.Location.X+20, ctrl.Location.Y+30);
            //Shows the SuperToolTip in the specified location
            this.superToolTip1.Show(tooltip, this.PointToScreen(pt1), 1000);
            IsShown = true;
        }
    }
    else
    {
        this.superToolTip1.Hide();
        IsShown = false;
    }
}

 

VB

Private IsShown As Boolean = False
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove
    Dim ctrl As Control = Me.GetChildAtPoint(e.Location)
    If ctrl IsNot Nothing Then
      If ctrl Is Me.buttonAdv1 AndAlso (Not IsShown) Then
         'Initializes the ToolTipInfo
         Dim tooltip As New ToolTipInfo()
         tooltip.Body.Text = "SuperToolTip"
         'Sets the SuperToolTip
         Me.superToolTip1.SetToolTip(Me.buttonAdv1, tooltip)
         Dim pt1 As New System.Drawing.Point(ctrl.Location.X+20, ctrl.Location.Y+30)
          'Shows the SuperToolTip in the specified location
          Me.superToolTip1.Show(tooltip, Me.PointToScreen(pt1), 1000)
          IsShown = True
      End If
      Else
          Me.superToolTip1.Hide()
          IsShown = False
      End If
End Sub

Output:

Show supertooltip on disabled controls

 

Sample: View sample in GitHub.

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon