An alternative is the BIT() functions: local rr,gg,bb rr = BITRSHIFT( BITAND(Rgb, 16711680), 16) gg = BITRSHIFT( BITAND(Rgb, 65280),8) bb = BITAND(Rgb, 255) ? rr, gg, bb
Can you represent a hex value in fox? 16711680 in hex is 00FF0000, 65280 is 0000FF00 which are much easier to read. On Thu, Sep 30, 2010 at 2:29 AM, Dan Covill <[email protected]> wrote: > This one works: > > procedure ColorString > lparameters Rgb && integer RGB value > *-- Returns string "rgb(rrr,ggg,bbb)" > > local rr,gg,bb > rr = Mod(Rgb, 256) > gg = Mod(Int(Rgb / 256), 256) > bb = Int(Rgb / 65532) > *? rr, gg, bb > Result = "rgb("+Str(rr,3)+','+Str(gg,3)+','+Str(bb,3)+')' > return result > > Dan Covill > > On 9/29/2010 2:22 PM, Paul Newton wrote: >> Thanks Eurico but I am looking for a more generic solution. For >> example if I create a color object like this ... >> >> n =<some arbitrary value> >> >> loColor = _Screen.System.Drawing .Color.FromRGB(n) >> >> Or >> >> loColor = _Screen.System.Drawing .Color.Red/Blue/Indigo etc etc >> >> I need to be able to get the RGB value (n) of loColor >> >> Paul > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

