Tutorials > Tutorial 11 - Displaying Rows in Alternating Colors |
In this tutorial, you will learn how to use the AlternatingRowStyle property and built-in styles to apply alternating colors to list rows to improve their readability.
Start with the project used in Tutorial 9.
Right-click the list and select Properties from the context menu to display the Property Pages dialog box. Click the Splits tab and expand the Splits(00) object. Double-click the AlternatingRowStyle node to toggle its value.
The list has default settings for both the EvenRow and OddRow styles. We will use the default settings first then change the settings for the EvenRow style.
Run the program and observe the following:
TDBList1 displays data as in Tutorial 9, except that even-numbered rows have a light cyan background.
Right-click the list and select Properties from the context menu to display the Property Pages dialog box. Click the Style Factory tab and expand the EvenRow style.
Next, select the BackColor property of the EvenRow style and change it from Cyan to Light Gray. Click OK to close the property page.
Run the program and observe the following:
TDBList1 displays data as in the previous figure, except that even-numbered rows now have a light gray background.
To end the program, press the End button on the Visual Basic toolbar. You have successfully completed Tutorial 11.