When setting a form's opacity should I use a decimal or double?

Posted by Eggs McLaren on Stack Overflow See other posts from Stack Overflow or by Eggs McLaren
Published on 2008-07-31T21:42:52Z Indexed on 2010/05/23 10:50 UTC
Read the original article Hit count: 209

Filed under:
|

I'm new to C#, and I want to use a track-bar to change a form's opacity.

This is my code:

decimal trans = trackBar1.Value / 5000
this.Opacity = trans

When I try to build it, I get this error:

Cannot implicitly convert type 'decimal' to 'double'

I tried making trans a double, but then the control doesn't work. This code worked fine for me in VB.NET.

What do I need to do differently?

© Stack Overflow or respective owner

Related posts about c#

Related posts about beginner