//color为传入的颜色值,返回值不包含“0x”
private string ToHexColor(Color color)
{
string R = Convert.ToString(color.R, 16);
if (R == "0")
R = "00";
string G = Convert.ToString(color.G, 16);
if (G == "0")
G = "00";
string B = Convert.ToString(color.B, 16);
if (B == "0")
B = "00";
string HexColor = R + G + B;
return HexColor;
}