)
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 get the cell's information on mouse hovering in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: February 15, 2016 |
Last Revised Date: December 31, 2019
Tags: mouseover, size

Cell information

In order to get the cell’s information when hover the mouse on a cell, 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

 

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