ComponentOne List for WinForms
In This Topic
    Changing the Font Style of a Column
    In This Topic

    To change the font style of a column, set the Style.Font property either in the designer or in code.

    In the Designer

    1. Click the ellipsis button next to the Splits property in the Properties window to open the Split Collection Editor.
    2. Click the ellipsis button next to the DisplayColumns property to open the C1DisplayColumn Collection Editor.
    3. In the C1DisplayColumn Collection Editor, select the column that you would like to change in the Members list.
    4. In the Properties list, expand the Style class and locate the Font property. Click the ellipsis button next to the font name to open the Font dialog box.
    5. In the Font dialog box, you can select the font, font style, size, and effects.
    6. When finished click OK to close the Font dialog box, the C1DisplayColumn Collection Editor, and the Splits Collection Editor.

    In Code

    Add the following code, in this example the code was added to the Button1_Click event.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim fntFont As Font
    fntFont = New Font("Impact", Me.C1List1.Splits(0).DisplayColumns.Item("Company").Style.Font.Size, FontStyle.Italic)
    Me.C1List1.Splits(0).DisplayColumns.Item("Company").Style.Font = fntFont
    

    To write code in C#

    C#
    Copy Code
    Font fntFont;
    fntFont = new Font("Impact", this.c1List1.Splits[0].DisplayColumns["Company"].Style.Font.Size, FontStyle.Italic);
    this.c1List1.Splits[0].DisplayColumns["Company"].Style.Font = fntFont;
    

    This topic illustrates the following:

    When the Font Style button is clicked, the font in the Company column is changed to Impact and italic.

    See Also