int / double type conversion within function

I would like to do the following:

Label.BackColor = Color.FromArgb(2.56 * TrackBar.Value, 2.56 * TrackBar.Value, 2.56 * TracBar.Value);

I get error due to not matching variable types.

What would be the best / most elegant approach to handle things like this, namely multiplying some int values of controls directly within another function?


Thanks a lot in advance for taking your time!

i-ThomasAsked:
Who is Participating?
 
AlexFMCommented:
Label.BackColor = Color.FromArgb((int)(2.56 * TrackBar.Value), (int)(2.56 * TrackBar.Value), (int)(2.56 * TracBar.Value));
0
 
i-ThomasAuthor Commented:
Hello AlexFM!

Quick and great!

Thanks a lot!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.