The control supports multiline strings and word wrap.
Using the Designer
- Select the cells that need to be displayed in multiline or that need wrapping (for example: textBoxCell1).
- Select the Value property in the Properties window and input the desired string (for example: ABC).
- Set textBoxCell1.Style.Multiline property (CellStyle.Multiline property) to True from the Properties window.
- Set the textBoxCell1.Style.WordWrap property (CellStyle.WordWrap property) to True in the Properties window.
|
You cannot input multiline strings into the designer. In order to allow the user to insert new lines at runtime, refer to TextBoxCell. |
Using Code
When multiline is enabled, the strings in the cells are displayed as multiline text using the new line code.
[VB]
Imports GrapeCity.Win.MultiRow
GcMultiRow1.Rows(0).Cells(0).Value = "GrapeCity" & vbCrLf & "PowerTools"
GcMultiRow1.Rows(0).Cells(0).Style.Multiline = MultiRowTriState.True
GcMultiRow1.Rows(0).Cells(0).VerticalResize(30)
|
[CS]
using GrapeCity.Win.MultiRow;
gcMultiRow1.Rows[0].Cells[0].Value = "GrapeCity\r\nPowerTools";
gcMultiRow1.Rows[0].Cells[0].Style.Multiline = MultiRowTriState.True;
gcMultiRow1.Rows[0].Cells[0].VerticalResize(30);
|
When both multiline and word wrap are enabled, if the string length exceeds the cell width, the word wrapping occurs automatically.
[VB]
Imports GrapeCity.Win.MultiRow
GcMultiRow1.Rows(0).Cells(0).Value = "GrapeCity PowerTools"
GcMultiRow1.Rows(0).Cells(0).Style.Multiline = MultiRowTriState.True
GcMultiRow1.Rows(0).Cells(0).Style.WordWrap = MultiRowTriState.True
GcMultiRow1.Rows(0).Cells(0).VerticalResize(30)
|
[CS]
using GrapeCity.Win.MultiRow;
gcMultiRow1.Rows[0].Cells[0].Value = "GrapeCity PowerTools";
gcMultiRow1.Rows[0].Cells[0].Style.Multiline = MultiRowTriState.True;
gcMultiRow1.Rows[0].Cells[0].Style.WordWrap = MultiRowTriState.True;
gcMultiRow1.Rows[0].Cells[0].VerticalResize(30);
|
|
When the GDI+ Compatibility Mode is enabled, there might be cases where blank or space characters (visible when wrapped), are not displayed. |
See Also