VB.NET - Code Samples - Convert System.Drawing.Color to Hex String

VB.NET Convert System.Drawing.Color to Hex String Function

Synopsis:

VB.NET Drawing.Color does not provide a method to Convert System.Drawing.Color to Hex String. Below is a function to return the hex string from a drawing.color object.

The Code:

	Private Function GetHexColor(colorObj as System.Drawing.Color) as String
		return "#" & Hex(colorObj.R) & Hex(colorObj.G) & Hex(colorObj.B)
	End function
About this page: