# Region [color: hexadecimal to RGB]
/// <Summary>
/// [Color: hexadecimal to RGB]
/// </Summary>
/// <Param name = "strcolor"> set the hexadecimal color [returns RGB] </param>
/// <Returns> </returns>
Public static system. Drawing. Color colorhx16torgb (string strhxcolor)
{
Try
{
If (strhxcolor. Length = 0)
{// If it is null
Return System. Drawing. color. fromargb (0, 0, 0); // set it to black
}
Else
{// Convert the color
Return System. drawing. color. fromargb (system. int32.parse (strhxcolor. substring (1, 2), system. globalization. numberstyles. allowhexspecifier), system. int32.parse (strhxcolor. substring (3, 2), system. globalization. numberstyles. allowhexspecifier), system. int32.parse (strhxcolor. substring (5, 2), system. globalization. numberstyles. allowhexspecifier ));
}
}
Catch
{// Set to black
Return System. Drawing. color. fromargb (0, 0, 0 );
}
}
# Endregion
# region [color: Convert RGB to hexadecimal format]
///
// [color: RGB to hexadecimal format]
///
/// Red int
/ // green int
// blue int
/ //
Public static string colorrgbtohx16 (int r, int g, int B)
{< br> return system. drawing. colortranslator. tohtml (system. drawing. color. fromargb (R, G, B);
}< BR ># endregion