Articles in this section
Category / Section

How to set supertooltip for cells in WinForms GridControl?

1 min read

Set SuperToolTip

To set the SuperToolTip for each cell in a WinForms 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)
{
    int row, col;
    GridCurrentCell cc = this.gridControl1.CurrentCell;
    if (this.gridControl1.PointToRowCol(new Point(e.X, e.Y), out row, out col) && (col != hoverCol || row != hoverRow)) 
    {
        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}", hoverRow, hoverCol);
        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 <> hoverCol OrElse row <> hoverRow) Then
 hoverCol = col
 hoverRow = 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}", hoverRow, hoverCol)
 superToolTip1.Show(tinfo, screenPoint)
    End If
End Sub

 

The following screenshot displays the Grid with SuperToolTip.

 

Show the tooltip to grid cell

View Sample in GitHub

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

Conclusion

I hope you enjoyed learning on how to set Supertooltip for cells in WinForms GridControl.

You can refer to our WinForms GridControl featuretour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our our WPF GridControl example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied