delphi RGB与TColor的转换

冷暖自知 提交于 2019-11-27 05:09:29
1.RGB转换为Tcolor
function RGBToColor(R,G,B: byte): Tcolor;
begin
  Result := B Shl 16 or G  shl 8 or R;
end;
 
2.Tcolor转换为RGB
 
proceudre Tform1.Button1Clink(Sender: Tobject);
var
  Color: TColor;
  R, G, B: integer;
begin
  Color := ClBlack;
  R := Color and $FF;
  G := (Color and $FF00) shr 8;
  B := (Color and $FF0000) shr 16;
end;

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!