Articles in this section
Category / Section

How to get cell's information on mouse hovering in WinForms GridGroupingControl?

1 min read

Cell information

In order to get the cell’s information when hover the mouse on a cell in WinForms GridGroupingControl, TableControlCellMouseHoverEnter event can be used and cell rectangle width and height of a cell can be retrieved RangeInfoToRectangle.

C#

this.gridGroupingControl1.TableControlCellMouseHoverEnter += gridGroupingControl1_TableControlCellMouseHoverEnter;
void gridGroupingControl1_TableControlCellMouseHoverEnter(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventArgs e)
{
   Rectangle rectangle = new Rectangle();
   e.TableControl.CurrentCell.MoveTo(e.Inner.RowIndex, e.Inner.ColIndex);
   GridCurrentCell currentCell= e.TableControl.CurrentCell;
   if (e.Inner.ColIndex > 0)
   {
      rectangle =  e.TableControl.RangeInfoToRectangle(GridRangeInfo.Cell(e.Inner.RowIndex, e.Inner.ColIndex));
   }
   if (currentCell.Renderer != null)
   {
      String text = "Table:" + e.TableControl.TableDescriptor.Name +"\n"+ "Col Index: " +  e.Inner.ColIndex +"\n" + "cell bounds:" + rectangle + "\n" +"Cell Width:" + rectangle.Width +"\n" + "Cell Height:" + rectangle.Height +"\n" + "Col Text :" + currentCell.Renderer.ControlText"\n" +;
     GridTableControl tablecontrol = gridGroupingControl1.TableControl;
     tooltip1.SetToolTip(tablecontrol, text + "CellSize: " + cellSize);
     tooltip1.Active = true;
   }
}

 

VB

tooltip1 = New ToolTip()
AddHandler Me.gridGroupingControl1.TableControlCellMouseHoverEnter, AddressOf gridGroupingControl1_TableControlCellMouseHoverEnter
Private Sub gridGroupingControl1_TableControlCellMouseHoverEnter(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventArgs)
   Dim rectangle As New Rectangle()
   e.TableControl.CurrentCell.MoveTo(e.Inner.RowIndex, e.Inner.ColIndex)
   Dim currentCell As GridCurrentCell = e.TableControl.CurrentCell
   If e.Inner.ColIndex > 0 Then
      rectangle =      Me.gridGroupingControl1.GetTableControl(e.TableControl.TableDescriptor.Name).RangeInfoToRectangle(GridRangeInfo.Cell(e.Inner.RowIndex, e.Inner.ColIndex))
   End If
    If currentCell.Renderer IsNot Nothing Then
       Dim text As String = "Table:" & e.TableControl.TableDescriptor.Name & "Col Index: " & e.Inner.ColIndex & "cell bounds:" & rectangle & "Cell Width:" & rectangle.Width & "Cell Height:" & rectangle.Height & "Col Text :" & currentCell.Renderer.ControlText
       Dim tablecontrol As GridTableControl = gridGroupingControl1.TableControl
       tooltip1.SetToolTip(tablecontrol, text)
       tooltip1.Active = True
    End If
End Sub

 

Screenshot

Show the collection of data information while hovering the cell

Samples:

C#: CellInformation_CS

VB: CellInformation_VB

 

Conclusion

I hope you enjoyed learning about how to get the cell's information on mouse hovering in WinForms GridGroupingControl.

You can refer to our WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

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  to leave a comment
Access denied
Access denied