函数用法:通用函数保护(protect)某Cell,某行或某列防止用
函数名:gf_set_color
参数: dw_setcolor (datawindow) ,row (integer),col (integer)
INTEGER li_i
STRING ls_str
dw_setcolor.setredraw(FALSE)
//重设背景
dw_setcolor.modify("#" + STRING(col)+".background.mode=2")
dw_setcolor.modify("#" + STRING(col)+".background.color=16777215")
IF row = 0 THEN
//改变某列颜色
ls_str = "#" + STRING(col)+".background.color = '536870912~trgb(230,230,230)' )"
dw_setcolor.modify(ls_str)
ls_str = "#" + STRING(col)+".protect = '1'"
dw_setcolor.modify(ls_str)
ELSEIF col = 0 THEN
// 改变某行颜色
dw_setcolor.Modify("DataWindow.Detail.Color= '1000~tif( getrow() = " +STRING(row)+ ",rgb(230,230,230),536870912) '")
FOR li_i = 1 TO INTEGER(dw_setcolor.Object.DataWindow.Column.Count)
dw_setcolor.modify(ls_str)
dw_setcolor.modify("#" + STRING(li_i)+ ".protect = '0~tif( getrow() = " +STRING(row)+ " ,1,0)'")
NEXT
ELSE
//改变cell颜色
ls_str = "#" + STRING(col)+".background.color = '1000~tif( getrow() = " +STRING(row)+ ",rgb(230,230,230),536870912) '"
// messagebox("",ls_str)
dw_setcolor.modify(ls_str)
dw_setcolor.modify("#" + STRING(col)+ ".protect = '0~tif( getrow() = " +STRING(row)+ " ,1,0)'")
END IF
dw_setcolor.setredraw(TRUE)