DynamicBackColor, DynamicForeColor
These properties are among the things that make grids so cool. Using these properties, you can specify conditions for each column of a grid to base its colors on anything you want (though you'll usually base them on data in the grid). So, you can show negative balances in red, or color a grid like a checkerboard, or show sales on Sunday in purple on white. In fact, you can even drive your users to distraction by basing a column's colors on things like the day of the week or the time of day. Usage | colColumn.DynamicBackColor = cColorExpression cColorExpression = colColumn.DynamicBackColor colColumn.DynamicForeColor = cColorExpression cColorExpression = colColumn.DynamicForeColor |
Example | * Suppose you have a form containing a grid showing the * TasTrade Products table. Some products are discontinued. * Rather than having a separate column to indicate that, * you could show those products in reverse video. * For each column, the DynamicBackColor is set as * (assume This is the grid): This.DynamicBackColor = "IIF(Products.Discontinued, ; This.ForeColor, This.BackColor)" * And set the DynamicForeColor as: This.DynamicForeColor = "IIF(Products.Discontinued, ; This.BackColor, This.ForeColor)" |
See Also | BackColor, DynamicAlignment, DynamicFontBold, DynamicFontItalic, DynamicFontName, DynamicFontOutline, DynamicFontShadow, DynamicFontSize, DynamicFontStrikeThru, DynamicFontUnderline, DynamicInputMask, ForeColor, RGB() |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.