Colour Values

Zenerdiode

Active Member
Licensed User
I'm busy building an app that users answer questions on a 1 to 5 scale. Various averages are done to give a final score - a decimal value between 1 and 5. I then wanted to present the result in a colour ranging from red for 1, through yellow to green for 5. I've managed this - attached is an example demo - however, it reminds me of a recent post by TWELVE about a function sub returning more than one variable.

I've accomplished my task with two subs; one for the red value and one for the green, I was then thinking of using the integer value representing the colour and manipulating that, so I could use "Label1.FontColor=integer" instead of "Label1.FontColor=r,g,b" but I can't see how the integer is derived.
 

Attachments

  • Colour.sbp
    904 bytes · Views: 169

colin9876

Active Member
Licensed User
nice

Nice bit of coding there.
The number shown on ur form is the negative integer that represents the colour, the conversions done by int = R*256*256 +G*256 +B or something like that and the signed bit makes it show as negative
 
Last edited:
Top