What is the difference between the alignment in WinForms GridControl?
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.TextAlign = GridTextAlign.Right; // set horizontal alignment this.gridControl1.ColStyles.HorizontalAlignment = GridHorizontalAlignment.Center; // set Vertical alignment this.gridControl1.ColStyles.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.
Figure 1: Alignment in GridControl
The default text alignment is left.