Programmatically setting BackColor

  • Thread starter Thread starter Joe Thompson
  • Start date Start date
J

Joe Thompson

Hi,

I am using managed C++ and want to programmatically set the forms BackColor
from either four values (A,R,G, B) or one value ARGB. I tried putting this
is the form's load method:

Color clr;
clr.FromArgb(ARGB);
this->BackColor = clr;

It compiles and runs but the color doesn't change. Any ideas or better ways
of doing this?

Thank you,
Joe
 
Color clr;
clr.FromArgb(ARGB);
this->BackColor = clr;

It compiles and runs but the color doesn't change. Any ideas or better ways
of doing this?

"FromArgb" returns a Color structure thus use:

this->BackColor = Color.FromArgb(ARGB);
 
Color clr;
clr.FromArgb(ARGB);
this->BackColor = clr;

It compiles and runs but the color doesn't change. Any ideas or better ways
of doing this?

"FromArgb" returns a Color structure thus use:

this->BackColor = Color.FromArgb(ARGB);
 
Hi Peter,

It actually took Color::FromArgb (instead of Color.FromArgb) but it worked.

Thanks you,
Joe
 
It actually took Color::FromArgb (instead of Color.FromArgb) but it
worked.

Ah, yes -- too much C# for me :)

// pt
 
* "Joe Thompson said:
I am using managed C++ and want to programmatically set the forms BackColor
from either four values (A,R,G, B) or one value ARGB. I tried putting this
is the form's load method:

Just use this ('FromArgb' is a static method):

\\\
this->BackColor = Color::FromArgb(ARGB);
///
 
Back
Top