29-04-2013, 11:21 AM
وعليكم السلام ورحمة الله
حل سريع باستخدام IntToHex/StrToInt/Copy دون دعم لليونيكود
حل سريع باستخدام IntToHex/StrToInt/Copy دون دعم لليونيكود
كود :
function MakeRGB(r, g, b: Byte): COLORREF;
begin
result:=StrToInt('$00'+IntToHex(b,2)+IntToHex(g,2)+IntToHex(r,2));
end;
function GetBValueX(RGB:Cardinal):Byte;
begin
result:=StrToInt('$'+copy(IntToHex(RGB,8),3,2) );
end;
function GetGValueX(RGB:Cardinal):Byte;
begin
result:=StrToInt('$'+copy(IntToHex(RGB,8),5,2) );
end;
function GetRValueX(RGB:Cardinal):Byte;
begin
result:=StrToInt('$'+copy(IntToHex(RGB,8),7,2) );
end;
