delphi 颜色转换成 HTML 颜色代码


本文整理自网络,侵删。

 TColor to HTML color (颜色转换成 HTML 颜色代码)
TColor to HTML color
From Zarko Gajic,
Your Guide to Delphi Programming.
FREE Newsletter. Sign Up Now!
Put a TColorDialog (ColorDialog1), a TLabel (Label1) and a TButton (Button1) in your form, and assign the Button1.OnClick procedure as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.Button1Click(Sender: TObject) ;

function ColorToHtml(DColor:TColor):string;
var
tmpRGB : TColorRef;
begin
tmpRGB := ColorToRGB(DColor) ;
Result:=Format('#%.2x%.2x%.2x',
[GetRValue(tmpRGB),
GetGValue(tmpRGB),
GetBValue(tmpRGB)]) ;
end; {function ColorToHtml}

begin
if ColorDialog1.Execute then
Label1.Caption:=ColorToHtml(ColorDialog1.Color) ;
end;

相关阅读 >>

Delphi流类 遍历读取流中的所有数据

Delphi memo 字符串换行

Delphi 方便的文本文件操作(text)

Delphi调用winapi: getsystemmetrics - 获取系统度量等数值信息

Delphi中调用必应搜索(bing)的api函数

Delphi 一行一行读取txt文件

Delphi 获取cpu monitor使用率

Delphi整理二(object pascal语言)

Delphi从全路径中分离路径,有'\'

Delphi 字符串变形替换

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...