Saturday, July 28, 2012

How to convert HTML Color code to RGB color code

  1. Module modMain  
  2.   Public Function ConvertHTMLToRGBColor(ByVal sHtmlColor As StringAs Color  
  3.     'Remove the # if exists  
  4.     sHtmlColor = sHtmlColor.Replace("#""")  
  5.     Return Color.FromArgb(System.Convert.ToInt32(sHtmlColor.Substring(0, 2), 16), System.Convert.ToInt32(sHtmlColor.Substring(2, 2), 16), System.Convert.ToInt32(sHtmlColor.Substring(4, 2), 16))  
  6.   End Function  
  7. End Module 

No comments:

Post a Comment