How to change the row color on mouse hover in WinForms GridGroupingControl?
Change the row color
By default,
the current record will be highlighted if record is selected. If you want to
change the row color while hovering the mouse, it can be achieved by handling
the TableControlCellMouseHoverEnter,
TableControlCellMouseHoverLeave and QueryCellStyleInfo events. This
article explains how to change the row color on mouse hover in WinForms GridGroupingControl. Refer the below code
snippet.
C#
//Invoke the events to change the color of row during the mouse hover.
this.gridGroupingControl1.TableControlCellMouseHoverEnter += gridGroupingControl1_TableControlCellMouseHoverEnter;
this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (hoveredIndex == e.TableCellIdentity.RowIndex)
{
//Set the back color for the mouse hovered row.
e.Style.BackColor = Color.LightBlue;
}
}
void gridGroupingControl1_TableControlCellMouseHoverEnter(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventArgs e)
{
//Set the hovered row index to change the backcolor.
hoveredIndex = e.Inner.RowIndex;
this.gridGroupingControl1.TableControl.Refresh();
}VB
' Invoke the events to change the color of row during the mouse hover.
AddHandler Me.gridGroupingControl1.TableControlCellMouseHoverEnter, AddressOf gridGroupingControl1_TableControlCellMouseHoverEnter
AddHandler Me.gridGroupingControl1.QueryCellStyleInfo, AddressOf gridGroupingControl1_QueryCellStyleInfo
' Declare a variable to store the hovered row index
Private hoveredIndex As Integer = -1
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs)
If hoveredIndex = e.TableCellIdentity.RowIndex Then
' Set the back color for the mouse hovered row.
e.Style.BackColor = Color.LightBlue
End If
End Sub
Private Sub gridGroupingControl1_TableControlCellMouseHoverEnter(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventArgs)
' Set the hovered row index to change the backcolor.
hoveredIndex = e.Inner.RowIndex
Me.gridGroupingControl1.TableControl.Refresh()
End SubThe screenshot below illustrates the changing of row color when mousehover on the row.

Samples:
C#: MouseHover_CS
VB: MouseHover_VB
Conclusion
I hope you enjoyed learning about how to change the row color on mouse hover in WinForms GridGroupingControl.
You can refer to our WinForms GridGroupingControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms 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 WinForms GridGroupingControl and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!