我们知道在PB中使用rgb函数使用rgb颜色,但是怎么转换回来呢
st_1.backcolor = rgb(209,92,445)
参考帮助说明
Syntax
RGB ( red, green, blue )
Argument
Description
red
The integer value of the red component of the desired color
green
The integer value of the green component of the desired color
blue
The integer value of the blue component of the desired color
Return value
Long. Returns the long that represents the color created by combining the values specified in red, green, and blue. If an error occurs, RGB returns -1. If any argument's value is null, RGB returns null.
Usage
The formula for combining the colors is:
65536 * Blue+ 256 * Green+ Red
Use RGB to obtain the long value required to set the color for text and drawing objects. You can also set an object's color to the long value that represents the color. The RGB function provides an easy way to calculate that value
根据公式 65536 * Blue+ 256 * Green+ Red 生成
long ll_color
int li_r,li_g,li_b
//pb颜色值
li_color = long(sle_1.text)
//65536 * Blue+ 256 * Green+ Red
li_b = ll_color\ 65536
li_g = (ll_color - li_b * 65536) \ 256
li_r = ll_color - li_b * 65536 - li_g * 256
em_r.text = string(li_r)
em_g.text = string(li_g)
em_b.text = string(li_b)
文章介绍了如何在PB(PowerBuilder)环境中将使用RGB函数表示的颜色值分解回其红色、绿色和蓝色分量。通过提供的RGB公式65536*Blue+256*Green+Red,可以计算出每个分量的整数值。示例代码展示了如何从一个long颜色值解码出对应的red、green和blue值。
1047

被折叠的 条评论
为什么被折叠?



