How to write and read a Color in VB.NET
This article shows how to transform a color in hexadecimal representation.
The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: How to write and read a Color in VB.NET
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
Epic FaileditedPosted Jul 4, 2010, 2:44 AMEdited Jul 4, 2010, 2:45 AM
Public Function HexToColor(ByVal strHex As String) As Color Return Color.FromArgb(Convert.ToUInt32(strHex, 16)) End Function Public Function ColorToHex(ByVal cColor As Color) As String Return Hex(cColor.ToArgb) End Function Public Function ColorToHex(ByVal R As Byte, ByVal G As Byte, ByVal B As Byte) As String Return Hex(CUInt((R << 16) + (G << 8) + B)) End Function