如何使指定ITEM单元格变色?
问题描述:
如何在使用SETITEM后修改的各个单元格字体变成兰色,其他单元格仍保留黑色字体?
解决方案:
string ls_modstring,ls_rows[]
long ll_row,ll_col,ll_pos
for ll_pos = 1 to long(dw_1.object.datawindow.column.count)
ls_rows[ll_pos] = ""
next
dw_1.setredraw(false)
//假设此处要修改第2行、第1列
ll_row = 2
ll_col = 1
dw_1.setitem(ll_row,ll_col,"TESTData")
if len(ls_rows[ll_col]) = 0 then
ls_rows[ll_col] = string(ll_row)
else
ls_rows[ll_col] = ls_rows[ll_col] + "," + string(ll_row)
end if
ls_modstring = "#"+string(ll_col)+".Color='0~tcase(getrow() when "+ ls_rows[ll_col] +" then rgb(0,0,255) else rgb(0,0,0))'"
dw_1.Modify(ls_modstring)
//假设此处要修改第4行、第2列
ll_row = 4
ll_col = 2
dw_1.setitem(ll_row,ll_col,"TESTData2")
if len(ls_rows[ll_col]) = 0 then
ls_rows[ll_col] = string(ll_row)
else
ls_rows[ll_col] = ls_rows[ll_col] + "," + string(ll_row)
end if
ls_modstring = "#"+string(ll_col)+".Color='0~tcase(getrow() when "+ ls_rows[ll_col] +" then rgb(0,0,255) else rgb(0,0,0))'"
dw_1.Modify(ls_modstring)
dw_1.setredraw(true)