Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740

    Unanswered: display HexRGB colour choices for selection

    i need allow a user to select a Hex RGB color code from a table of nearly 300 codes.

    my table looks something like:

    HexCode
    #000066
    #000099
    #0000CC
    #0000FF
    #003300
    #003333
    #003366
    #003399
    #0033CC
    #0033FF
    #006600
    #006633
    #006666

    i'm looking for a cunning way to allow the user to select/define their desired colour. obviously the naked HexRGB code itself doesn't speak loudly to a normal human.

    ?? an elegant way to display "swatches" of the colour choices in Access?
    or
    ?? an elegant way to allow the user to build a colour on-screen (and later convert to (nearest (defined as visually nearest)) matching HexRGB)

    thanks for any input.

    izy
    currently using SS 2008R2

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    ...and in the spirit of "post wot u got", here is my current attempt:
    Code:
    Private Sub lstColor_AfterUpdate()
        Dim cR As Integer
        Dim cG As Integer
        Dim cB As Integer
        cR = "&H" & Mid$(Me.lstColor, 2, 2)
        cG = "&H" & Mid$(Me.lstColor, 4, 2)
        cB = "&H" & Mid$(Me.lstColor, 6, 2)
        Me.lstColor.BackColor = RGB(cR, cG, cB)
    ...doesn't fall into "elegant" in my opinion.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    this is the best I could find. it only gets you half way there, I'm not sure if you can get RGB values back out of it...
    Last edited by Teddy; 02-16-06 at 16:12.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    ...very promising Teddy

    OK, it's crashed a test MDB twice since you posted the link, but as Healdem says: atgofia erioed ad 'r bstards chrensia 'ch i lawr

    thanks, izy
    currently using SS 2008R2

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    done

    Hex(mybox.backcolor)
    returns HexBGR code but that's easy enough to fix

    thanks again Teddy

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    sweet.

    I'll have to bury this one in my own bag of tricks while I'm at it.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •