Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何设置rgb颜色?_C++_Rgb_C++builder_Firemonkey - Fatal编程技术网

C++ 如何设置rgb颜色?

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 ,

如何将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 ,  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吗?