BadButBit

hi,

I'm trying to hack my way around another problem by converting a variable of color type to three int32 variables R, G & B. from color to RGB is working but the refuse does not

R = color.R

G = color.G

B = color.B

this works fine but....

color.R = R

results in a Error 1 Property 'R' is 'ReadOnly'.

is there another way around this

BadButBit



Re: Visual Basic Express Edition RGB to Color conversion

nobugz

A quick glance through the Color structure documentation in MSDN library would reveal Color.FromArgb(). Use the Force Luke...





Re: Visual Basic Express Edition RGB to Color conversion

JohnWein

How do you get to Error 1 Property 'R' is 'ReadOnly' Don't you get a squiggly blue line under color.R = R

Code Snippet

Dim C As New Color

Dim R As Byte = C.R

C = Color.FromArgb(C.A, R, C.G, C.B)





Re: Visual Basic Express Edition RGB to Color conversion

BadButBit

hi,

thanks.... I tried that

Code Snippet

Dim thisColor As Color

Dim A, R, G, B As Integer

Dim Color As Color

Color = Color.Red

A = Color.A

R = Color.R

G = Color.G

B = Color.B

thisColor.FromArgb(A, R, G, B)

and thisColor is still black.. (0,0,0,0)

BadButBit





Re: Visual Basic Express Edition RGB to Color conversion

BadButBit

ok....

ok... I get it...

Code Snippet

Dim thispen As New Pen(Color.FromArgb(A, R, G, B), intWidth)

thanks

BadButBit