FlexGrid lets you customize text in various ways such as changing its font, margin, orientation, alignment, effects and so on. This topic caters to various aspects of text styling by taking a particular row object. However, if you wish to use an existing built-in style or want to create your own custom style to re-use it, see the corresponding topics.
To change font of text in a particular row or column object, you can use Font property of its CellStyle. Following code shows how to change font of the WinForms FlexGrid row.
However, if you want to change font of the whole grid, you can set Font property of the C1FlexGrid class. Following code shows how to change font of the entire WinForms FlexGrid.
To set margin on text of a particular row or column, you can set Margins property of the CellStyle. Use the code below to change margins in WinForms FlexGrid row.
To change the orientation and display a text as vertical text, you can set TextDirection property of CellStyle of the object. Also, to display the vertical text properly, you may have to adjust height of the target cells depending upon the text length. Below code lets you set vertical text in the WinForms FlexGrid row.
To wrap a text which is longer than the available cell width, you can set the WordWrap property of its CellStyle to true. Following code demonstrates how to apply text wrap in the WinForms FlexGrid row.
To display trimmed text when text is longer than the cell width, set Trimming property of the style which takes its values from StringTrimming enumeration. Use the code below to trim the long text to display ellipsis character in the WinForms FlexGrid row.
You can set the text alignment or position of the text with respect to cell by using the TextAlign property. The property accepts values from the TextAlignEnum enumeration.
Use the code below to apply text alignment on the WinForms FlexGrid row.
To set various effects on the text, you can use the TextEffect property which accepts its values from TextEffectEnum enumeration.
Apply text on the WinForms FlexGrid row using the following code.