ComponentOne FlexGrid for WinForms
Word Wrapping in a Header or Fixed Row
FlexGrid for WinForms Task-Based Help > Word Wrapping in a Header or Fixed Row

To set word wrapping in a header or fixed row, set the Height and WordWrap properties.

  1. Set the Caption property for a column header in the grid.

    In the Designer

    • Select a column in the grid. This will open the Column Tasks menu for that column.
    • In the Column Caption box, enter Word Wrapping in Header.

    Alternatively, the Caption property can also be set using the C1FlexGrid Column Editor.

    • Open the C1FlexGrid Column Editor. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor.
    • Select a column in the right pane and set the Caption property in the left pane to Word Wrapping in Header.
    • Click OK to close the editor.

    In Code

    Add the following code to the Form_Load event.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1FlexGrid1.Cols(1).Caption = "Word Wrapping in Header"
    

    To write code in C#

    C#
    Copy Code
    this.c1FlexGrid1.Cols[1].Caption = "Word Wrapping in Header";
    
  2. Set the row height of the header.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1FlexGrid1.Rows(0).Height = 3 * Me.C1FlexGrid1.Rows.DefaultSize
    

    To write code in C#

    C#
    Copy Code
    this.c1FlexGrid1.Rows[0].Height = 3 * this.c1FlexGrid1.Rows.DefaultSize;
    
  3. Enable word wrapping for the fixed cells.

    In the Designer

    • Open the C1FlexGrid Style Editor. For details on how to access the C1FlexGrid Style Editor, see Accessing the C1FlexGrid Style Editor.
    • Select Fixed in the Built-In Styles list.
    • Locate the WordWrap property in the right pane and set it to True.
    • Click OK to close the designer.

    In Code

    Add the following code to the Form_Load event:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1FlexGrid1.Styles("Fixed").WordWrap = True
    

    To write code in C#

    C#
    Copy Code
    this.c1FlexGrid1.Styles["Fixed"].WordWrap = true;
    

This topic illustrates the following:

In this example, a three-line header is created, and the text is wrapped.