BUG with the Color.FromArgb function?

G

Guest

I use a ColorDialog control to select a number of custom colours using the code segment below, I've fixed the index to 0 for the purpose of highlighting the problem.

Dim intRed As Integer
Dim intGreen As Integer
Dim intBlue As Integer

ColorDialog1.ShowDialog()

intRed = Color.FromArgb(ColorDialog1.CustomColors(0)).R
intGreen = Color.FromArgb(ColorDialog1.CustomColors(0)).G
intBlue = Color.FromArgb(ColorDialog1.CustomColors(0)).B

Panel1.BackColor = Color.FromArgb(intRed, intGreen, intBlue)

BUT, it appears that the above implementation of Color.FromArgb has got the red and blue values the wrong way around, since the above line displays a different colour to the one I selected. However, when I swap the red and blue values around (as shown below) it works correctly. Is this a bug or am I doing something wrong?

Panel1.BackColor = Color.FromArgb(intBlue, intGreen, intRed)

Many thanks.
Steve
 
C

Claes Bergefall

It's a bug. See
http://groups.google.se/[email protected]&lr=&hl=sv

/claes

Steve Randall said:
I use a ColorDialog control to select a number of custom colours using the
code segment below, I've fixed the index to 0 for the purpose of
highlighting the problem.
Dim intRed As Integer
Dim intGreen As Integer
Dim intBlue As Integer

ColorDialog1.ShowDialog()

intRed = Color.FromArgb(ColorDialog1.CustomColors(0)).R
intGreen = Color.FromArgb(ColorDialog1.CustomColors(0)).G
intBlue = Color.FromArgb(ColorDialog1.CustomColors(0)).B

Panel1.BackColor = Color.FromArgb(intRed, intGreen, intBlue)

BUT, it appears that the above implementation of Color.FromArgb has got
the red and blue values the wrong way around, since the above line displays
a different colour to the one I selected. However, when I swap the red and
blue values around (as shown below) it works correctly. Is this a bug or am
I doing something wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top