This thread is for discussions of VB Express Color Object to Hex String.
Want to boost your .NET application performance?
Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.
Try it for yourself now.
In VB Express can you not use
Imports System.Drawing.ColorTranslator
Then just code
txtHtmlName.Text = ToHtml(cPreview.BackColor)
txtHtmlName.Text = Drawing.ColorTranslator.ToHtml(cPreview.BackColor)
Back to a color
cPreview.BackColor = Drawing.ColorTranslator.FromHtml(txtHtmlName.Text)
There are lots of color functions but I had to spend a lot of time finding good examples
Like
Imports System.Drawing.Color
cPreview.BackColor = FromArgb(c.Red, c.Green, c.Blue)
Just thought I would share these
David
Yes, that gives you am html compatible string, or if you want the Hex version just do:
"#" + System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Green).ToString("X6")