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 tooltip that vary from cell to cell in the WinForms GridControl?

Platform: WinForms |
Control: GridControl
Tags: tooltip


You can use the System.Windows.Forms.Tooltip class to add tips that vary from cell to cell in an Essential Grid and it is performed using a MouseMove event handler. As you move to a different cell, you can turn off the current tip when it is visible and reset it with your new text depending upon the current cell. The following code example illustrates how to achieve this.


//declaring ToolTip
private System.Windows.Forms.ToolTip toolTip1;
private int hooverRow = -1;
private int hooverCol = -1;
private void Form1_Load(object sender, EventArgs e)
   //Initialize the tip with desired timing parameters
   this.toolTip1 = new System.Windows.Forms.ToolTip();
   toolTip1.InitialDelay = 500; //Half a second delay
   toolTip1.ReshowDelay = 0;


'declaring ToolTip
Private toolTip1 As System.Windows.Forms.ToolTip
Private hooverRow As Integer = -1
Private hooverCol As Integer = -1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
   'Initialize the tip with desired timing parameters
   Me.toolTip1 = New System.Windows.Forms.ToolTip()
   toolTip1.InitialDelay = 500 'Half a second delay
   toolTip1.ReshowDelay = 0
End Sub

The following code example illustrates turning off/on ToolTip on MouseMove event.


private void gridControl1_MouseMove(object sender, MouseEventArgs e)
   int row, col;
   if(this.gridControl1.PointToRowCol(new Point(e.X, e.Y), out row, out col)
&& (col != hooverCol || row != hooverRow))
      hooverCol = col;
      hooverRow = row;
      if(this.toolTip1 != null && this.toolTip1.Active)
        this.toolTip1.Active = false; //Turn it off
      this.toolTip1.SetToolTip(this.gridControl1, string.Format("tooltip: row {0}, column {1}", hooverRow, hooverCol));
      this.toolTip1.Active = true; //Make it active so it can show


Private Sub gridControl1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim row, col As Integer
   If Me.gridControl1.PointToRowCol(New Point(e.X, e.Y), row, col) AndAlso (col <> hooverCol OrElse row <> hooverRow) Then
     hooverCol = col
     hooverRow = row
     If Me.toolTip1 IsNot Nothing AndAlso Me.toolTip1.Active Then
       Me.toolTip1.Active = False 'Turn it off
     End If
     Me.toolTip1.SetToolTip(Me.gridControl1, String.Format("tooltip: row {0}, column {1}", hooverRow, hooverCol))
     Me.toolTip1.Active = True 'Make it active so it can show
   End If
End Sub

The following screenshot illustrates the Tooltip in GridControl.

Show the tooltip in GridControl

Figure 1: Tooltip in GridControl.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/WF-15688_How_do_I_display_tips_that_vary_from_cell_to_cell-551440905.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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