程序代码:
* 用颜色显示不同分数的行 PUBLIC oForm oForm = NEWOBJECT("Form1") oForm.Show Return DEFINE CLASS form1 AS form DoCreate = .T. AutoCenter = .T. Caption = "Form1" Name = "form1" ADD OBJECT grid1 AS grid WITH ; Height = 228, ; Left = 12, ; Top = 12, ; Width = 348, ; Name = "Grid1" PROCEDURE Init * 生成测试临时数据表 Create Cursor Cj (编号 C(4),总分 N(3)) =Rand(-1) For lnI=1 To 50 Insert Into Cj Values (Padl(lnI,4,"0"),Rand()*100) EndFor * 结束 Go Top With ThisForm.Grid1 .RecordSource="Cj" .SetAll('DynamicBackColor','iif(总分>=90,Rgb(255,0,0),Iif(Between(总分,60,89),Rgb(0,128,0),Rgb(255,0,255)))','Column') EndWith ENDPROC ENDDEFINE