private string GetAssColor(string color, string def= "&H00FFFFFF")
{
if (string.IsNullOrEmpty(color))
return def;
KnownColor c;
string ret;
if (knowcolors.ContainsKey(color))
return knowcolors[color];
if (color.StartsWith("#"))
{
ret = "&H";
color = color.Substring(1);
if (color.Length > 6)
{
ret += color.Substring(0, 2);
color = color.Substring(2);
}
else
ret += "00";
ret += color.Substring(4, 2);
ret += color.Substring(2, 2);
ret += color.Substring(0, 2);
return ret;
}
int i;
if (int.TryParse(color, out i))
{
ret = "&H" + i.ToString("X8");
}
return def;
}