Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Store Color in Database

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Resolved [RESOLVED] [2005] Store Color in Database

    I was trying to find a way to store a color object in a database field. I tried to find away to get the color as RGB values, but I see 'getARGB()' but no
    'setARGB()'

    How can I do this?

    Justin Fox
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  2. #2
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: [2005] Store Color in Database

    You could store the RGB value as a delimited string like "255,255,255". When you pull it out, split it and then use int16.parse()

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Store Color in Database

    I would store it as an integer in the database.

    Color structures have a .ToArgb method that produce an integer representation of the AARRGGBB values of the color. Store that value, and you can recall it into a color structure using Color.FromArgb(integer)

    Code:
            Dim myColor As Color = Color.Red
            Dim myARGBValue As Integer = myColor.ToArgb
            Dim myOtherColor As Color = Color.FromArgb(myARGBValue)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: [2005] Store Color in Database

    Cool Thanks!

    Justin Fox
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

Posting Permissions

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



Click Here to Expand Forum to Full Width