Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 [RESOLVED] RGB to Integer and Back

$
0
0
.

My web app will be outputting color codes to my vb.net app.

In the web app, i have ColorR, ColorG, ColorB. each ranging from 0 to 254.
To save bandwidth, i intend to convert these three numbers into a single number.
and then, once my VB app receives it, convert it back to RGB.

I've been using the magic google, but i can't find anything to explain how to do it both ways.

for example, i found this:
Code:

dim i as integer = 6421504
dim c as color

c = System.Drawing.Color.FromArgb(i)
Probably the Alpha channel is missing, so you'd have to use

c = System.Drawing.Color.FromArgb(i or &Hff000000)

but it doesn't explain how to convert the rgb to the integer.

any help would be appreciated.
(won't be using alpha)

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>