Dennis Myrén said:
This is an example function:
<code>
public static string ToHtml ( System.Drawing.Color color )
{
return string.Concat("#", (color.ToArgb() & 0x00FFFFFF).ToString("X6"));
}
</code>
but also we should handle the transparent color, we could do that by
modifying the function a bit:
<code>
public static string ToHtml ( System.Drawing.Color color )
{
if (System.Drawing.Color.Transparent == color)
return "Transparent";
return string.Concat("#", (color.ToArgb() & 0x00FFFFFF).ToString("X6"));
}
</code>
I used your code and it works fine for some sample code, but in my
application I get the color as RGB long value and I try to convert it to
system color using this method
r=(System.Drawing.Color)System.ComponentModel.TypeDescriptor.GetConverter(typeof(System.Drawing.Color)).ConvertFromString(ppFont.Color.RGB.ToString());
this results in wrong color creation. i.e for blue color it gives red color.
Is there some other method through which I can convert the RGB long value to
color object.
Please help.