Category / Section
How to increase the column width of the rowheader in WinForms GridGroupingControl?
2 mins read
Column width of rowheader
The column width of the RowHeaders can be increased, based on its values in the GridGroupingControl, through the QueryColWidth event. The change of row header width is used in the NumberedRowHeaders. The following code example demonstrates the same.
C#
//Increases the ColWidth of the NumberedRowHeader.this.gridGroupingControl1.TableModel.QueryColWidth += TableModel_QueryColWidth; void TableModel_QueryColWidth(object sender, GridRowColSizeEventArgs e) { if(e.Index ==0) { //Increases the RowHeader width based on digit count. e.Size = 30; e.Handled = true; }}
VB
'Increases the ColWidth of the NumberedRowHeader. Private Me.gridGroupingControl1.TableModel.QueryColWidth += AddressOf TableModel_QueryColWidth Private Sub TableModel_QueryColWidth(ByVal sender As Object, ByVal e As GridRowColSizeEventArgs) If e.Index =0 Then 'Increases the RowHeader width based on digit count. e.Size = 30 e.Handled = True End If End Sub
The following images show the column width of the RowHeaders before and after the increase.
Figure 1: Before using the QueryColWidth event
Figure 2: After using the QueryColWidth event
Samples:
C#: https://www.syncfusion.com/downloads/support/directtrac/general/CS737315718.zip
VB: https://www.syncfusion.com/downloads/support/directtrac/general/VB1023996440.zip