Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12376104
  • 博文数量: 1293
  • 博客积分: 13501
  • 博客等级: 上将
  • 技术积分: 17974
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-08 18:11
文章分类

全部博文(1293)

文章存档

2019年(1)

2018年(1)

2016年(118)

2015年(257)

2014年(128)

2013年(222)

2012年(229)

2011年(337)

分类:

2012-05-25 18:12:22

一、图解现象

 

image

图1 progressBar1.Maximum = 300; currentVal = 200-1;

 

image

图2 正常的除法用法

 

image

图3 错误的C#除法用法

 

二 得出结论


在C#中使用除法的正常用法:

int percentComplete = (int)((float)i / (float)u_data.currentVal * u_data.maxVal);


错误用法:
//int percentComplete = (int)(u_data.maxVal / (u_data.currentVal * 100));

阅读(4309) | 评论(0) | 转发(0) |
0

上一篇:优先级设置为最高。

下一篇:唐骏篇

给主人留下些什么吧!~~