delphi RGB与TColor的转换

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;

 

转载于:https://www.cnblogs.com/blogpro/p/11345939.html

你可能感兴趣的:(delphi RGB与TColor的转换)