Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

[5664] VB Express Color Object to Hex String

Last post 09-14-2006 11:18 AM by jsobell. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [5664] VB Express Color Object to Hex String

    This thread is for discussions of VB Express Color Object to Hex String.

    • Post Points: 15
  • 07-01-2006 8:49 PM In reply to

    • David Cox
    • Not Ranked
    • Joined on 05-05-2006
    • United Kingdom
    • New Member
    • Points 85

    Re: [5664] VB Express Color Object to Hex String

    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

    • Post Points: 5
  • 09-14-2006 11:18 AM In reply to

    • jsobell
    • Not Ranked
    • Joined on 08-01-2006
    • Junior Member
    • Points 110

    Re: [5664] VB Express Color Object to Hex String

    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")

     

    • Post Points: 5
Page 1 of 1 (3 items)