)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set Supertooltip for cells in WinForms GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: April 21, 2015 |
Last Revised Date: December 18, 2019

Set SuperToolTip

To set the SuperToolTip for each cell in a GridControl, you can use MouseMove event. By using this event, you can set the tooltip to get the corresponding row and column index by setting the PointToRowCol method.

The following code example explains how to set SuperToolTip for each cell in a GridControl by using MouseMove event.

C#

private void gridControl1_MouseMove(object sender, MouseEventArgs e)
{
  SuperToolTip superToolTip1 = new SuperToolTip();
    int row, col;            
    GridCurrentCell cc = this.gridControl1.CurrentCell;            
        if (this.gridControl1.PointToRowCol(new Point(e.X, e.Y), out row, out col) && (col != hooverCol || row != hooverRow))
        {
            hoverCol = col;
            hoverRow = row;
            Rectangle rect = this.gridControl1.GetCellRenderer(row, col).GetCellBoundsCore(row, col, false);
            Point screenPoint = this.gridControl1.PointToScreen(new Point(rect.Left, rect.Top));
            ToolTipInfo tinfo = new ToolTipInfo();
            tinfo.Header.Text = string.Format(" row {0}, column {1}", hooverRow, hooverCol);
            superToolTip1.Show(tinfo, screenPoint);                
        }
}

 

VB

Private Sub gridControl1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim superToolTip1 As New SuperToolTip()  
Dim row, col As Integer
  Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
    If Me.gridControl1.PointToRowCol(New Point(e.X, e.Y), row, col) AndAlso (col <> hooverCol OrElse row <> hooverRow) Then
 hooverCol = col
 hooverRow = row
 Dim rect As Rectangle = Me.gridControl1.GetCellRenderer(row, col).GetCellBoundsCore(row, col, False)
 Dim screenPoint As Point = Me.gridControl1.PointToScreen(New Point(rect.Left, rect.Top))
 Dim tinfo As New ToolTipInfo()
 tinfo.Header.Text = String.Format(" row {0}, column {1}", hooverRow, hooverCol)
 superToolTip1.Show(tinfo, screenPoint)
    End If
End Sub

 

The following screenshot displays the Grid with SuperToolTip.

 

Show the tooltip to grid cell

Samples:

C#: Control ToolTip-C#

VB: Control ToolTip-VB

Reference link: https://help.syncfusion.com/windowsforms/grid-control/tooltip

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