Programmatically setting BackColor

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
 
P

Peter Theill

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);
 
P

Peter Theill

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);
 
J

Joe Thompson

Hi Peter,

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

Thanks you,
Joe
 
P

Peter Theill

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

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

// pt
 
H

Herfried K. Wagner [MVP]

* "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);
///
 

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