How to set the current row bold in WinForms GridControl?
Change the font style
The current row data can be changed to Bold font style by using the PrepareViewStyleInfo event. Using this event, the style can be changed by validating whether the CurrentCell is in a WinForms GridControl. But the current row range has to be refreshed while activating the cell and deactivating the cells.
gridControl1.CurrentCellActivated += gridControl1_CurrentCellActivated;
gridControl1.CurrentCellDeactivated += gridControl1_CurrentCellDeactivated;
gridControl1.PrepareViewStyleInfo += gridControl1_PrepareViewStyleInfo;
void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridControlBase grid = gridControl1;
GridCurrentCell cc = gridControl1.CurrentCell;
if (e.RowIndex > grid.Model.Rows.HeaderCount && e.ColIndex > grid.Model.Cols.HeaderCount && cc.HasCurrentCellAt(e.RowIndex))
{
e.Style.Font.Bold = true;
}
}
void gridControl1_CurrentCellDeactivated(object sender, GridCurrentCellDeactivatedEventArgs e)
{
GridControlBase grid = gridControl1;
GridCurrentCell cc = gridControl1.CurrentCell;
//Checks if Deactivate is called stand-alone or called from MoveTo and the row is moving.
if (!cc.IsInMoveTo || cc.MoveToRowIndex != cc.MoveFromRowIndex)
{
grid.RefreshRange(GridRangeInfo.Row(e.RowIndex), GridRangeOptions.MergeAllSpannedCells);
}
}
void gridControl1_CurrentCellActivated(object sender, EventArgs e)
{
GridControlBase grid = gridControl1;
GridCurrentCell cc = gridControl1.CurrentCell;
//Checks if Activate is called stand-alone or called from MoveTo and the row is moving.
if (!cc.IsInMoveTo || cc.MoveToRowIndex != cc.MoveFromRowIndex
|| !cc.MoveFromActiveState)
{
grid.RefreshRange(GridRangeInfo.Row(cc.RowIndex), GridRangeOptions.MergeAllSpannedCells);
}
}AddHandler gridControl1.CurrentCellActivated, AddressOf gridControl1_CurrentCellActivated
AddHandler gridControl1.CurrentCellDeactivated, AddressOf gridControl1_CurrentCellDeactivated
AddHandler gridControl1.PrepareViewStyleInfo, AddressOf gridControl1_PrepareViewStyleInfo
Private Sub gridControl1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)
Dim grid As GridControlBase = gridControl1
Dim cc As GridCurrentCell = gridControl1.CurrentCell
If e.RowIndex > grid.Model.Rows.HeaderCount AndAlso e.ColIndex > grid.Model.Cols.HeaderCount AndAlso cc.HasCurrentCellAt(e.RowIndex) Then
e.Style.Font.Bold = True
End If
End Sub
Private Sub gridControl1_CurrentCellDeactivated(ByVal sender As Object, ByVal e As GridCurrentCellDeactivatedEventArgs)
Dim grid As GridControlBase = gridControl1
Dim cc As GridCurrentCell = gridControl1.CurrentCell
'Checks if Deactivate is called stand-alone or called from MoveTo and the row is moving.
If (Not cc.IsInMoveTo) OrElse cc.MoveToRowIndex <> cc.MoveFromRowIndex Then
grid.RefreshRange(GridRangeInfo.Row(e.RowIndex), GridRangeOptions.MergeAllSpannedCells)
End If
End Sub
Private Sub gridControl1_CurrentCellActivated(ByVal sender As Object, ByVal e As EventArgs)
Dim grid As GridControlBase = gridControl1
Dim cc As GridCurrentCell = gridControl1.CurrentCell
'Checks if Activate is called stand-alone or called from MoveTo and the row is moving.
If (Not cc.IsInMoveTo) OrElse cc.MoveToRowIndex <> cc.MoveFromRowIndex OrElse (Not cc.MoveFromActiveState) Then
grid.RefreshRange(GridRangeInfo.Row(cc.RowIndex), GridRangeOptions.MergeAllSpannedCells)
End If
End SubThe screenshot below displays the CurrentRow FontStyle in the Grid.

Samples:
Conclusion
I hope you enjoyed learning about how to set the current row bold in WinForms GridControl.
You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!