Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fill each record in a grid with different color
Message
 
To
21/02/2001 21:30:46
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00478268
Message ID:
00478273
Views:
23
>Can we set each row in a grid with different color?
>
>We want to use at least 6 colors (black,red,green,yellow, purple, blue)
>
>I've tried using the grid.dynamicbackColor but only 2 colors can be used.
>
>Thanks a lot for your help,

You can use more than 2 colors with DynamicBackColor. To do it directly, you'd have to embed several IIF() statements, which isn't very maintainable. Instead, I'd recommend that you put a UDF call in the DynamicBackColor property. You can make that UDF a method on the form. Code it something like this: (I haven't run this code to test it.)
lparameter tnRecno

do case
case mod(tnRecno,6) = 0
   return "RGB(0,0,0)"
case mod(tnRecno,5) = 0
   return "RGB(255,0,0)"
case mod(tnRecno,4) = 0
   return "RGB(0,255,0)"
case mod(tnRecno,3) = 0
   return "RGB(0,0,255)"
case mod(tnRecno,2) = 0
   return "RGB(255,0,255)"
otherwise
   return "RGB(0,255,255)"
endcase
Previous
Reply
Map
View

Click here to load this message in the networking platform