"R,G,B"形式で書かれた文字列またはWebカラー名の文字列をcolor型データに変換します。
StringToColor
関数書式
color StringToColor(
string color_string // 変換する文字列
);
- 引数
引数名 | 初期値 | I/O | 詳細 |
color_string | - | IN | "R,G,B"形式の文字列または、Webカラー名の文字列 |
- 戻り値
color型データ
- その他
無し
- サンプル
#property strict
void OnInit() {
color str_color;
str_color=StringToColor("0,127,0");
Print(str_color);
Print((string)str_color);
printf("0x%06x",str_color);
Print("\n");
str_color=StringToColor("0,128,0");
Print(str_color);
Print((string)str_color);
printf("0x%06x",str_color);
Print("\n");
str_color=StringToColor("clrRed");
Print(str_color);
Print((string)str_color);
printf("0x%06x",str_color);
}