小编Egg*_*ren的帖子

将十进制转换为双倍?

我想使用轨迹栏来改变窗体的不透明度.

这是我的代码:

decimal trans = trackBar1.Value / 5000;
this.Opacity = trans;
Run Code Online (Sandbox Code Playgroud)

当我构建应用程序时,它会出现以下错误:

无法隐式转换decimaldouble.

我尝试使用trans,double但然后控件不起作用.这段代码在过去的VB.NET项目中运行良好.

c# floating-point double decimal type-conversion

645
推荐指数
14
解决办法
5万
查看次数

标签 统计

c# ×1

decimal ×1

double ×1

floating-point ×1

type-conversion ×1