-
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
-
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
>
>
-
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
>
>
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks