如何将delphi的colordialog点选出来的color转化为网页常用颜色格式?(50分)

  • 主题发起人 iceheart
  • 开始时间
I

iceheart

Unregistered / Unconfirmed
GUEST, unregistred user!
如何将delphi的colordialog点选出来的color转化为网页常用颜色格式,如#00ff00
我先ColorToString(ColorDialog1.Color),发现除常用色外,其它颜色的形式是:$00669966这样
取了很多值观察,发现与网页用的颜色格式相比,只是前面少了#,多出$00三个字符
所以我把前三个字符去掉,再添加一个#,可是在网页上显示出来的颜色并不选取的颜色。

这说明我的转换方法不对。请问应该如何转换?

(在线等待中……)
 
可参考Delphi帮助文件(Visual Component Libary Reference)中关于TColor的说明,
其中有你问题的答案。
 
你都"取了很多值观察,发现与网页用的颜色格式相比,只是前面少了#,多出$00三个字符"
了,怎么还不一样?
 
[blue]to gy87sz[/blue]
delphi帮助里查出来的,我E文不太好,看来看去,好像和我理解的差不多呀
为什么我去掉头三位以后,出现的颜色就不是我想要的颜色了?

If you specify TColor as a specific 4-byte hexadecimal number
instead of using the constants defined in the Graphics unit,
the low three bytes represent RGB color intensities for blue,
green, and red, respectively. The value $00FF0000 represents
full-intensity, pure blue, $0000FF00 is pure green, and $000000FF
is pure red. $00000000 is black and $00FFFFFF is white.

If the highest-order byte is zero ($00), the color obtained is
the closest matching color in the system palette. If the
highest-order byte is one ($01), the color obtained is the
closest matching color in the currently realized palette.
If the highest-order byte is two ($02), the value is matched
with the nearest color in the logical palette of the current
device context.


[blue]to wangxd[/blue]
我观察的是色颜的表达格式,不是色颜,不然别人会以为我色弱了[:(]
 
//所以我把前三个字符去掉,再添加一个#,可是在网页上显示出来的颜色并不选取的颜色
是16进制的逆转换
 
to ledo
说具体点,该怎么算啊?
 
没人理我[:(]
我已经自己解决了。
原来是这样:
delphi html
$00112233<==>#332211
 
接受答案了.
 
顶部