Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change forecolor in grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00613552
Message ID:
00613601
Vues:
9
>Good day all,
>I want to change the forecolor in a grid based on a criteria. The grid contains 5 column, the fifth column contains numbers between 1 to 5. The color changed based on the number
> eg 1 - blue/white
> 2 - green/white
> 3 - red/white etc.
>

You would use the DynamicForeColor property of the grid to accomplish this.

You could put in the form's init, the following code:

MyColor="IIF(Thisform.grdGrid1.Column5.Text1=1,RGB(0,0,255),;
IIF(Thisform.grdGrid1.Column5.Text1=2,RGB(0,255,0),;
IIF(Thisform.grdGrid1.Column5.Text1=3,RGB(255,0,0),;
IIF(Thisform.grdGrid1.Column5.Text1=4,RGB(255,0,0),;
IIF(Thisform.grdGrid1.Column5.Text1=5,RGB(255,0,0),RGB(0,0,0))))))"

Thisform.grdGrid1.SetAll("DynamicForeColor",MyColor,"Column")

The DynamicForeColor is evaluated for each row and not the whole grid at a time.

Hope this helps.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform