复制代码
procedure TForm3.ToolButton9Click(Sender: TObject);   //  字体颜色
  function ColorToHtml(DColor:TColor):string;
  var   //delphi tcolor 颜色 转成 网页颜色 格式
   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
   Memo1.SelText := '<span style="color: '+  ColorToHtml( ColorDialog1.Color) +';">'
                      +Memo1.SelText+'</span>' ;
end;
复制代码