如何获取某行的背景颜色!急急急

python与大数据分析
博客专家认证
2003-11-07 05:10:12
因为数据窗口的行的颜色是由程序动态产生的,如何获取某行的颜色!
...全文
91 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
高手多谢了,不过我有个问题私下请教你
  • 打赏
  • 举报
回复
如果表达式是在数据窗口事件中定义的,表达时也可以获取吗,我试一试,先谢了
lmby 2003-11-10
  • 打赏
  • 举报
回复
你不是把表达式设置成这样了么:this.modify("#"+string(li_i)+".color = '0~t if(currentrow()=getrow(),134217741),rgb(255,255,255)'")


那么:
ls_color = dw_sheet.describe( "Evaluate('if(currentrow()=getrow(),134217741),rgb(255,255,255)', " + string( ll_row ) + ")")
  • 打赏
  • 举报
回复
自己顶一下
  • 打赏
  • 举报
回复
我是在数据窗口的click事件中下
如果当前行未被选中,则选中,否则再次单击时不选中
关键问题是iselected(row)不起作用,因此需要知道当前行的颜色才能知道是否被选中过
int li_i,li_count
string ls_column,ls_column_name,ls_type //列名和列名对应文本
string ls_text,ls_test

li_count = integer(this.Object.DataWindow.Column.Count)
//ls_test = this.describe("evaluate('#1.background.color'),"+ string(row) + ")")
ls_test = string(this.object.c_type[row].background.color)
for li_i = 1 to li_count
//选中时的代码
if isselected(row) = true then
this.Modify("#"+string(li_i)+".Background.Mode = 0")
this.modify("#"+string(li_i)+".background.color = '0~t if(currentrow()=getrow(),rgb(255,255,255),134217741)'")
this.modify("#"+string(li_i)+".color = '0~t if(currentrow()=getrow(),134217741),rgb(255,255,255)'")
//取消时的代码
else
this.Modify("#"+string(li_i)+".Background.Mode = 0")
this.modify("#"+string(li_i)+".background.color = '0~t if(currentrow()=getrow(),134217741,rgb(255,255,255))'")
this.modify("#"+string(li_i)+".color = '0~t if(currentrow()=getrow(),rgb(255,255,255),134217741)'")
end if
end if
next
qqjj7758 2003-11-07
  • 打赏
  • 举报
回复
上面的代码我能理解
可搂主的意思 我糊涂了 。。。。。。。。。。
lmby 2003-11-07
  • 打赏
  • 举报
回复
你设一定是一列列设的。假设你的表达式为: if(mod(getrow(),2)=1,0,455333)
那么:

string ls_color
long ll_row

ll_row = dw_sheet.getrow()
ls_color = dw_sheet.describe( "Evaluate('if(mod(getrow(),2)=1,0,454333)', " + string( ll_row ) + ")")


ok~



lmby
  • 打赏
  • 举报
回复
理解错误,是当前行的颜色。
如果每行颜色不同,以上代码取的是那行的颜色
adeva 2003-11-07
  • 打赏
  • 举报
回复
string ls_bkcor
ls_bkcor= this.Describe("c_sheet_no.Background.color")
ls_bkcor为当前列"c_sheet_no"的当前行背景颜色!

string ls_txcor
ls_txcor= this.Describe("c_sheet_no.Background.color")
ls_txcor为当前列"c_sheet_no"的当前行字体颜色!

如果要改变其颜色再用modify()函数即可
zhangdatou 2003-11-07
  • 打赏
  • 举报
回复
这个问题~~~帮你顶
  • 打赏
  • 举报
回复
在数据窗口clicked事件中如何获取row的background.color 和 color?
  • 打赏
  • 举报
回复
不同行背景色和字体颜色是不同的,同一行颜色均相同,只求某一行的颜色
qqjj7758 2003-11-07
  • 打赏
  • 举报
回复
不相信你不知道阿
难道我理解错了?
qqjj7758 2003-11-07
  • 打赏
  • 举报
回复
describe()

609

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧