DataColumn.EnableCellDraw 方法 |
命名空间: VO
1CLASS ColorColumn INHERIT DataColumn 2 PROTECT oValidTextColor AS Color 3 PROTECT oValidBackground AS Brush 4 PROTECT oInvalidTextColor AS Color 5 PROTECT oInvalidBackground AS Brush 6 7 METHOD Init( oFieldSpec ) CLASS ColorColumn 8 SUPER:Init( oFieldSpec ) 9 10 oValidTextColor := Color{ COLORWHITE } 11 oValidBackground := Brush{ Color{ COLORBLUE } } 12 oInvalidTextColor := Color{ COLORYELLOW } 13 oInvalidBackground := Brush{ Color{ COLORRED } } 14 15 RETURN SELF 16 17 METHOD Init( oWindow, iCtlID, oServer ) CLASS ColorSubForm 18 // 一些初始化代码 19 SELF:Browser := ColorSubForm_Browser{ SELF } 20 21 oDBDUE_DATE := ColorColumn{ ACCOUNTS_DUE_DATE{} } 22 oDBDUE_DATE:Width := 12 23 oDBDUE_DATE:HyperLabel := oDCDUE_DATE:HyperLabel 24 oDBDUE_DATE:Caption := "DueDate" 25 26 SELF:Browser:AddColumn( oDBDUE_DATE ) 27 28 oDBDUE_DATE:EnableCellDraw( #ValidDateDraw ) 29 // 更多初始化代码 30 RETURN SELF 31 32 METHOD ValidDateDraw( uValue ) CLASS ColorColumn 33 IF uValue < GetPastDueDate() 34 SELF:CellTextColor := oValidTextColor 35 SELF:CellBackground := oValidBackground 36 ELSE 37 SELF:CellTextColor := oInvalidTextColor 38 SELF:CellBackground := oInvalidBackground 39 ENDIF 40 41 RETURN NIL