By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Using Color.FromArgb values with Convert.ToInt32

P: n/a
sp
I have this strange problem. The application I am working on imports
color values from Flash that look like this:

0x-f9fff6

And, on the script side, it uses a conversion algorithm to
convert them into Color.FromArgb values:

Color.FromArgb(&H78 + Convert.ToInt32(aPixels(k)))

K is the loop index. I added &H78 because I read somewhere that it
should be in front of the hex value in order for the Color.FromArgb to
read it properly. But then again Convert.ToInt32() might be doing the
same thing. FYI, I also tried running it without &H78 and it didn't
work. Whatever is happening in that convert statement is screwing up
the program.

This should work under normal circumstances. But it doesn't work and
this brings me here. Please help.

Nov 16 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
>
K is the loop index. I added &H78 because I read somewhere that it
should be in front of the hex value in order for the Color.FromArgb to
read it properly. But then again Convert.ToInt32() might be doing the
same thing. FYI, I also tried running it without &H78 and it didn't
work. Whatever is happening in that convert statement is screwing up
the program.

This should work under normal circumstances. But it doesn't work and
this brings me here. Please help.
Being in-front means being in the most significant bits of the 32 bit
number. Try this:

Color.FromArgb(&H78 << 24 Or Convert.ToInt32(aPixels(k)))

Nov 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.