本文整理自网络,侵删。
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 getmodulefilename函数的用法(可以获取项目的路径,桌面的路径,我的文档的路径)
Delphi webbroker standalone 模式下当作一个普通的 webserver 响应静态网页或其它文件的请求
更多相关阅读请进入《Delphi》频道 >>