Saturday, 14 September 2013

Color to RGB and hex Value

HexConverter
 
DialogResult result = colorDialog1.ShowDialog();
if (result == DialogResult.OK)
{
    Color c=colorDialog1.Color;
    string HexConverter= "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
}

RGBConverter

DialogResult result = colorDialog1.ShowDialog();
if (result == DialogResult.OK)
{
    Color c=colorDialog1.Color;
    string HexConverter= "RGB(" + c.R.ToString() + "," + c.G.ToString() + "," + c.B.ToString() + ")";
}

No comments:

Post a Comment