Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RGB( )
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: RGB( )
Divers
Thread ID:
00065722
Message ID:
00065731
Vues:
31
Denis,

There may be an easy way to get it, but here's the hard way. The first thing you need to know is how the 12632256 is calculated. The formula is red*(256**0)+green*(256**1)+blue*(256**2). So to go back do this:

nRgbVal=12632256
nBlue=INT(nRgbVal/(256**2))
nRgbVal=nRgbVal % (256**2)
nGreen=INT(nRgbVal/(256**1))
nRed=nRgbVal % (256**1)

Of course, you can 256**0=1, 256**1=256 and 256**2=65536, but I use exponents to illustrate how the number you start with is really 3 appended base 256 numbers.

>Hello
>How can I get the red, green and blue components from the nColor represented as numeric value. For example: I have nColor variable. nColor=12632256. I want to get value: nRed=192,nGreen=192,nBlue=192
>Thanks.
>Denis Gavrikov.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform