>for each oColumn in this.Columns > with oColumn > .DynamicBackColor = 'iif(inlist('+; > str(.ColumnOrder)+',1,5,7) or type('+; > .ControlSource+') = "C", rgb(255,255,0), rgb(0,255,255))' > endwith >endfor >Since the dynamic properties in grids actually use an equivalent of Eval(), and they are re-evaluated for each cell on each refresh, I tend to be as picky as possible not to involve function calls, or method calls as well. Now, since RGB() is a function, yielding an integer, and we're building a string... and rgb(255,255,0) will always be the same number, let's insert this number instead:
.DynamicBackColor = 'iif(inlist('+; str(.ColumnOrder)+',1,5,7) or type('+; .ControlSource+') = "C",'+tran(rgb(255,255,0))+','+tran(rgb(0,255,255))+')'I'd also gladly omit the outer iif, and build two different strings instead, one for columns 1, 5 and 7, and another for the others. One less to recalculate for each cell.
* Assuming color determining method is in grid class >for each oColumn in this.Columns > oColumn.DynamicBackColor = '(this.SetColor("'+oColumn.Controlsource+'"))' >endforI've had this in the framework we use, and it was just too slow. Not visibly slow, though, but a real pain if you debugged. Any refresh would cause about forty calls to this method. On slower machines, you didn't even need the debugger to see this slow down.