Articles in this section
Category / Section

What is the difference between the alignment in WinForms GridControl?

1 min read

Difference between the alignment in GridControl

TextAlign is set when the description of embedded controls is to be aligned to the left or right. For example, in a combobox cell, setting the TextAlign to right aligns the text to the right of the combobox button.

HorizontalAlignment is set, when the cell value is to be aligned either left or right or center of the cell. In the same way the VerticalAlignment is set, when the cell value is to be aligned either at the top or bottom or at the middle of the cell.


// set text alignment as right
this.gridControl1.ColStyles[2].TextAlign = GridTextAlign.Right;
// set horizontal alignment
this.gridControl1.ColStyles[3].HorizontalAlignment = GridHorizontalAlignment.Center;
// set Vertical alignment
this.gridControl1.ColStyles[4].VerticalAlignment = GridVerticalAlignment.Bottom;


' set text alignment as right
Me.gridControl1.ColStyles(2).TextAlign = GridTextAlign.Right
' set horizontal alignment
Me.gridControl1.ColStyles(3).HorizontalAlignment = GridHorizontalAlignment.Center
' set Vertical alignment
Me.gridControl1.ColStyles(4).VerticalAlignment = GridVerticalAlignment.Bottom

The following screenshot illustrates the alignment in GridControl.

Alignment in GridControl

Figure 1: Alignment in GridControl


The default text alignment is left.



C#: Alignments



Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment