开发者

Custom Delphi Colours

If i want to set a colour property to something thats non-standard (i.e. not something like clBlack or cl开发者_如何学GoRed) how can i do this? Can i set something like hexadecimal colours?


RGB in Windows.pas

function RGB(r, g, b: Byte): COLORREF;

you can cast the result to be a TColor.

e.g

MyColour := TColor(RGB(Red,Green,Blue));


you can use $00BBGGRR

BB = Blue
GG = Green
RR = Red

All these values can be between 0 and 255 ($00 and $FF)


I always used RGB macro: http://delphi.wikia.com/wiki/RGB


You might also want to check Colors in Delphi help page. If might be useful for Delphi developers who do web programming because Vcl.Graphics unit defines TColor values as clWeb____ web-friendly constants.

Many constants are already predefined and before you use them you can visually see how the colors look like. So there is no need to do RBG "mixes".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜