OLE_COLOR to R-G-B


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: OLE_COLOR to R-G-B

  1. #1
    Douglas Guest

    OLE_COLOR to R-G-B

    Hi all,

    Anyone got a sample of converting an OLE_COLOR into seperate R-G-B values?

    Thanks,
    Doug



  2. #2
    Larry Rebich Guest

    Re: OLE_COLOR to R-G-B

    Douglas,

    Some months ago I wrote a tip of the month that I call 'Color Value
    Conversions'. Link to http://www.buygold.net/tips.html then look for the
    November 1998 tip of the month. A sample program is provided that shows how
    to do the conversion...

    Cheers,
    Larry Rebich

    larry@buygold.net
    www.buygold.net


    "Douglas" <hot_n_cold_2000@hotmail.com> wrote in message
    news:393aaad4@news.devx.com...
    > Hi all,
    >
    > Anyone got a sample of converting an OLE_COLOR into seperate R-G-B values?
    >
    > Thanks,
    > Doug
    >
    >




  3. #3
    Rick Rothstein Guest

    Re: OLE_COLOR to R-G-B

    Here is a general function to get any specified color part from a color
    value:

    Function RGorB(RGBvalue As Long, R_G_or_B As String) As Integer
    Dim Exponent As Long
    Exponent = InStr("RGB", UCase$(Left$(R_G_or_B, 1))) - 1
    If Exponent = -1 Or RGBvalue < 0 Or RGBvalue > 16777216 Then
    RGorB = -1
    Else
    RGorB = RGBvalue \ 256 ^ Exponent Mod 256
    End If
    End Function

    where the first argument is the long color value (whole number as you call
    it) and the second argument is "R", "G", or "B" depending on which color
    value you want.


    Rick



    "Douglas" <hot_n_cold_2000@hotmail.com> wrote in message
    news:393aaad4@news.devx.com...
    > Hi all,
    >
    > Anyone got a sample of converting an OLE_COLOR into seperate R-G-B values?
    >
    > Thanks,
    > Doug
    >
    >




  4. #4
    Douglas Guest

    Re: OLE_COLOR to R-G-B


    Thanks to both of you!

    Doug

    PS: I was calling it an OLE_COLOR, because that is the name used to declare
    it as in:
    Private m_Color As OLE_COLOR


    "Rick Rothstein" <rick_newsgroup@email.com> wrote in message
    news:393b32af$1@news.devx.com...
    > Here is a general function to get any specified color part from a color
    > value:
    >
    > Function RGorB(RGBvalue As Long, R_G_or_B As String) As Integer
    > Dim Exponent As Long
    > Exponent = InStr("RGB", UCase$(Left$(R_G_or_B, 1))) - 1
    > If Exponent = -1 Or RGBvalue < 0 Or RGBvalue > 16777216 Then
    > RGorB = -1
    > Else
    > RGorB = RGBvalue \ 256 ^ Exponent Mod 256
    > End If
    > End Function
    >
    > where the first argument is the long color value (whole number as you call
    > it) and the second argument is "R", "G", or "B" depending on which color
    > value you want.
    >
    >
    > Rick
    >
    >
    >
    > "Douglas" <hot_n_cold_2000@hotmail.com> wrote in message
    > news:393aaad4@news.devx.com...
    > > Hi all,
    > >
    > > Anyone got a sample of converting an OLE_COLOR into seperate R-G-B

    values?
    > >
    > > Thanks,
    > > Doug
    > >
    > >

    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center