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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display the long text in header cells as viewable in WinForms GridControl?

Platform: WinForms |
Control: GridControl

Display the column header text

By default, the cell value will be displayed as per the data that we provided to the grid. In this case, if the particular column has the data with minimum length i.e. 3 to 4 characters and header text as long, the column will be resized as per the header text length.

                          Display the long column header text

In order to display the column header text fully and resize the column based on the data, the Orientation property can be used to display the header text as vertically.



for (int j = 0; j < this.grid.ColCount; j++)
   style1 = grid[0, j];
   font = style1.Font;
   //Rotate the text of Column header using array values
   font.Orientation = 270; 
   style1.Text = "Angle" + j.ToString();



For j As Integer = 0 To Me.grid.ColCount – 1
   style1 = grid(0, j)
   font = style1.Font
   'Rotate the text of Column header using array values
   font.Orientation = 270
   style1.Text = "Angle" & j.ToString()
Next j


GridGrouping Control


private void btnchange_Click(object sender, EventArgs e)
   foreach (GridColumnDescriptor column in     this.gridGroupingControl1.TableDescriptor.Columns)
      column.Appearance.ColumnHeaderCell.Font.Orientation = 270;   



Private Sub btnchange_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnchange.Click
   For Each column As GridColumnDescriptor In    Me.gridGroupingControl1.TableDescriptor.Columns
     column.Appearance.ColumnHeaderCell.Font.Orientation = 270
   Next column 
End Sub




Display the long column header text in cellgrid


Display the long column header text in datagrid


C#: Header Alignment_CS

VB: Header Alignment_VB


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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