if row > 0 then this.selectrow(0,false) end if[@more@]//====================================================================== //功 能:改变datawindwo数据行的颜色 // //参 数:datawindow adw_data//需要修改颜色的datawindow // //返回值:integer 1,成功 0,失败 //====================================================================== string ls_col string ls_modify string ls_des string ls_exp1 string ls_exp2 string ls_exp3 string ls_color1 string ls_color2 string ls_color3 string ls_color4 string ls_color5 integer li_colcount integer i string ls_enable integer li_pos1 integer li_pos2 // ls_color1 = "RGB(61,99,53)"//"rgb(255,247,198)" ls_color2 = "RGB(230,255,242)" ls_color3 = "RGB(255,255,255)" ls_color4 = "RGB(0,0,0)" ls_color5 = "RGB(128,128,128)" //数据行背景色 ls_exp1 = string(RGB(255,255,255)) + "~tif (getrow() = currentrow(),"& +ls_color1+", if( mod(getrow(),2)=0,"+ls_color2+","+ls_color3+"))" //数据行文字色 ls_exp2 = string(RGB(255,255,255)) + "~tif (getrow() = currentrow(),"+ls_color3+","+ls_color4+")" //无效数据文本色if( enable = "N" ,rgb(128,128,128), rgb(0,0,0) ) ls_exp3 = string(RGB(0,0,0)) + "~tif (getrow() = currentrow(),"& +ls_color3+",if (" li_colcount = integer(adw_data.describe("DataWindow.Column.Count")) //修改数据行的颜色 for i = 1 to li_colcount ls_col = adw_data.Describe("#"+string(i)+".Name") //修改数据行前景背景色 ls_modify = ls_col + ".Background.Color = '" + ls_exp1 + "'" adw_data.modify(ls_modify) ls_des = upper(adw_data.describe(ls_col+".Color")) if (pos(ls_des,'ENABLE') >0 or pos(ls_des,'C_ENABLE') >0 ) and pos(ls_des,'RGB(128,128,128)') > 0 then //取开始 li_pos1 = pos(ls_des,'(') + 1 //取结束 li_pos2 = pos(ls_des,'=') - 1 ls_enable = mid(ls_des,li_pos1,li_pos2 - li_pos1)+ "= ~"N~","+ls_color5+","+ls_color4+"))" ls_modify = ls_col+".Color = '" + ls_exp3 + ls_enable + "'" else ls_modify = ls_col + ".Color = '" + ls_exp2 + "'" end if adw_data.modify(ls_modify) //修改列名的背景色前景色 ls_modify = ls_col + "_t.Background.Color = '" + string(rgb(230,230,230)) + "'" adw_data.modify(ls_modify) ls_modify = ls_col + "_t.Color = '" + string(RGB(0,0,0)) +"'" adw_data.modify(ls_modify) next //修改所有文本框颜色 for i = 1 to li_colcount*2 ls_col = "t_" + string(i) ls_des = upper(adw_data.describe(ls_col+".Background.Color")) //能够正确得到其属性值 if ls_des '!' then //修改数据行下面的文本框背景色 if pos(ls_des,'IF') > 0 then ls_modify = ls_col + ".Background.Color = '" + ls_exp1 + "'" adw_data.modify(ls_modify) end if //修改列名下面的文本框 if pos(ls_des,'RGB(207,221,240)') > 0 then ls_modify = ls_col + ".Background.Color = '" + string(rgb(230,230,230)) + "'" adw_data.modify(ls_modify) end if end if next return 1
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/219138/viewspace-917904/,如需转载,请注明出处,否则将追究法律责任。