ComponentOne True DBGrid for WinForms
True DBGrid for WinForms Tutorials / Tutorial 12: Displaying Rows in Alternating Colors
In This Topic
    Tutorial 12: Displaying Rows in Alternating Colors
    In This Topic

    In this tutorial, you will learn how to use the AlternatingRows property and built-in styles to apply alternating colors to grid rows to improve their readability.

    Complete the following steps:

    1. Start with the project used in Tutorial 10: Enhancing the User Interface with In-Cell Bitmaps.
    2. In the Properties window, set the AlternatingRows property to True. The grid has default settings for both the EvenRow and OddRow styles. Use the default settings first and then change the settings for the EvenRowStyle.
    3. Run the program and observe that C1TrueDBGrid1 displays data as in Tutorial 10: Enhancing the User Interface with In-Cell Bitmaps except that even-numbered rows have a light cyan background.
    4. Click the ellipsis button next to the Styles property in the Properties window. This will bring up the C1TrueDBGrid Style Editor.
    5. Select the EvenRowStyle in the left pane, and in the right pane change its BackColor to LightGray. Click OK and close the editor.

    Run the program and observe the following:

    C1TrueDBGrid1 displays data as in the previous image, except that even-numbered rows now have a light gray background:


    This concludes the tutorial.