Reports for WinForms | ComponentOne
In This Topic
    Changing the Background Color of Rows and Columns
    In This Topic

    To change the background color of rows and columns in a table, set the BackColor property of the row and column.

    Note: The column BackColor property overrides the row BackColor property.

    Add the following code to the Form_Load event before the Add and Generate methods:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Set the Column color.    
    table.Cols(0).Style.BackColor = Color.PapayaWhip
    
    ' Set the Row color.    
    table.Rows(0).Style.BackColor = Color.PaleTurquoise
    

    To write code in C#

    C#
    Copy Code
    // Set the Column color.    
    table.Cols[0].Style.BackColor = Color.PapayaWhip;
    
    // Set the Row color.    
    table.Rows[0].Style.BackColor = Color.PaleTurquoise;
    

    What You've Accomplished

    The first column in the table is PapayaWhip and the first row in the table is PaleTurquoise: