C++ 如何设置rgb颜色?
如何将rgb颜色设置为任何组件?FireMonkey,C++Builder XE8。 我用过这个代码,但它没用C++ 如何设置rgb颜色?,c++,rgb,c++builder,firemonkey,C++,Rgb,C++builder,Firemonkey,如何将rgb颜色设置为任何组件?FireMonkey,C++Builder XE8。 我用过这个代码,但它没用 Rectangle1->Fill->Color = RGB(255, 50, 103); Rectangle1->Fill->Color = (TColor)RGB(255, 50, 103); 也许我必须使用RGBA?但是我不知道怎么做 我做到了 UnicodeString s ; s = "0xFF" ; s += IntToHex ( 255 ,
Rectangle1->Fill->Color = RGB(255, 50, 103);
Rectangle1->Fill->Color = (TColor)RGB(255, 50, 103);
也许我必须使用RGBA?但是我不知道怎么做
我做到了
UnicodeString s ;
s = "0xFF" ;
s += IntToHex ( 255 , 2 );
s += IntToHex ( 50 , 2 );
s += IntToHex ( 103 , 2 );
Rectangle1 -> Fill -> Color = StringToColor ( s );
此函数允许您将int指定的RGB值转换为TAlphaColor,FireMonkey使用TAlphaColor
TAlphaColor GetAlphaColor (int R, int G, int B)
{
TAlphaColorRec acr;
acr.R = R;
acr.G = G;
acr.B = B;
acr.A = 255;
return acr.Color;
}
此函数允许您将int指定的RGB值转换为TAlphaColor,FireMonkey使用TAlphaColor
TAlphaColor GetAlphaColor (int R, int G, int B)
{
TAlphaColorRec acr;
acr.R = R;
acr.G = G;
acr.B = B;
acr.A = 255;
return acr.Color;
}
没用是因为…?什么都没发生,颜色设置为零…没用是因为…?什么都没发生,颜色设置为零…你的意思是将A设置为255吗?你的意思是将A设置为255吗?